5
devBeat
225d

Hi fellow devs, I have a question for you.
Do you think asking questions like (related to JS):
- What is the type of null?
- What is the result of 0,1 + 0,2 (0,30004)
- and other JS specifics

in a job Interview for a Junior position is the right thing to sort out applicants?
I have several years of programming experience, just not in JS, and got rejected because I couldn’t answer these questions. Feels kinda weird😅 What’s your opinion?

Comments
  • 12
    If you think that the second question has anything to do with JS, then you really need to find out how a computer even works. It's that basic.
  • 0
    @fast-nop Yeah, true. And I kinda know why it’s not 0,3, but I‘m wondering how it affects my programming skills
  • 7
    @mrcgrhrdt For example: you don't do currency calculations in float, but in integer. E.g. not in Euro, but in Cent (or even tenth or hundredth or so of a Cent). You don't use step intervals like 0.1 in loops. You never compare floats for equality, only for intervals.

    Basically: you don't fuck up float calculations.

    Specifically for JS: you are aware that all numbers are floats internally, but that doesn't matter as long as you don't exceed their integer range and don't introduce fractions anywhere, or only fractions that have a binary representation composed of only 2^(-n) elements within the defined range. The latter is what 0.1 doesn't fulfil.
  • 0
    @Fast-Nop Ah that is interesting, thank you for the clarification! I guess that’s the same reason you usually use milliseconds to define time, e.g. the setTimeout() func.
  • 0
    Maybe the no-brain-needed answer is: use unit tests to ensure that you calculation function is calculating correctly.
  • 3
    I do not think these are good junior questions
  • 0
    @Fast-Nop nope.

    you don't use integers for currency.

    you pick a non-garbage language that has a type with decimal precision, and use that type.
  • 1
    @tosensei There are tons of software behind the scenes that still run on Cobol. Also, https://stackoverflow.com/questions...
  • 1
    Crap questions, dodged a bullet there op.

    I'd guess the type of null is object, because it's js and so it's all a fucked up pile of shite.
  • 1
    I think it's the worst thing to do.

    No one deals with these behaviors daily if the code is well tested.

    An interview should show your strengths in problem solving and communication.
  • 2
    @ChristoPy It should also test what they consider basics. These questions are not meant to qualify - they're meant to weed out. There are a lot of applicants who can't even code a Fizzbuzz in the programming language they're applying for.
  • 2
    @Fast-Nop Huh, when I read up on fizzbuzz last time I thought to myself: "that is easy". But I never actually tried the coding it. It was "easy", but I didn't think there would be a corner case. Sneaky little problem. It tells you if programmers can figure out issues with the data too.

    I am going to play with this with some other approaches for the fun of it. Lets see how complicated I can make this.
  • 1
    @Fast-Nop Oh, wait, I failed the instructions. My corner case was 0. You are supposed to start at 1. DOH!
  • 2
    @Demolishun That's the first test - can you read the requirements. ;-) You'd be shocked how many applicants can't solve it at all.

    And then there's a difference between devs who can solve it in 15 minutes vs. those who can do it in under 5 minutes.
  • 0
    @Fast-Nop I went ahead and did it regular loop, then some data driven with some std::for_each, std::iota, wasting a lot of memory, heh. Why TF won't C++ provide an algorithm that gives you an index? Probably because I am thinking about it wrong.
  • 1
    @Demolishun You don't need any of that. Just index modulo 3, modulo 5, and you don't even need an if or switch.
  • 2
    @Fast-Nop "need" and "fun" are different things.
  • 1
    @Demolishun Yeah, but going branchless is nice. There's also an implementation by another devRanter that doesn't even need modulo at all:

    https://devrant.com/rants/4949951/...
  • 1
    @Fast-Nop Wait, wtf: "The majority of comp sci graduates can't." This cannot be real.
  • 1
    @Demolishun There are a lot of CS grads who havn't coded at all, and also a lot who had taken like one semester and then never coded again. Not to mention the number of CS grads (fucking computer science!) who have no idea at all how a computer even works.

    devRant is not really representative of the real world out there.
  • 1
    @Fast-Nop When I first started working doing industrial controls work I had made the assumption that people I worked with had similar skills for the same job title. Over the years I have found this to be false. I have been disappointed in the abilities of others often. At my current job this is no longer the case. I am learning from other people quite a bit. I think I am growing more as a result.
  • 3
    I agree to @Fast-nop - but would go quite a bit further.

    If you _program_ anything - really anything, even a simple x = y + 1 - and you can't explain why it works or how it works , you might be doing it wrong TM.

    A fun game I played with my interns a few years back (spoiler: they wanted to murder me in very gruesome ways afterwards) ...

    Question: What does happen if you move a mouse plugged into a PC?

    The thing is - you can't answer the question, it's intentionally unspecific.

    Which was my intention, hence game - funny for me, not my interns.

    ... If you don't get it why it was only fun for me: again - you can't answer the question. E.g. it's a different thing wether it's USB or PS/2 or COM. Way of transmission... Way of signal interpretation... Driver / OS / Window Server... Every answer you give will be incomplete or not specific enough.

    The interns learned quite a lot, me included.

    The gist or morale of the game is to not stop asking why or how sth. works.

    Many devs are very fast in saying : I know how this works.... Without knowing it at all.

    Try to find out how interested and how curious the person is and how broad his knowledge is....

    A broad knowledge and curiosity is always a good foundation to build up on.

    Language specifics aren't entirely uninteresting, but they can be learned - curiosity and knowledge not.
  • 0
    @IntrusionCM agreed. A few years ago I stumbled upon Ben Eaters videos of his 8-bit bread board computer.

    And in that video he went deep into the electrical implementation of the logics circuit and most importantly the micro instructions that actually implement the machine code.

    And that was an eye opener, an area I never during 40 years of programming had even known I was missing :)

    Its never to late to learn something new, and being to old to learn has nothing to do with age and all to do with attitude :P
  • 1
    Bad questions if they demand an exact answer.

    But OK if they wanna hear if the candidate has a vague idea of how types and floating point works.

    If they say "LOL of course that math question is obviously always 0,3" you know they are clueless about floating point and probably haven't studied enough comp Sci in general.

    If they say "Not certain but I suspect there could be a floating point rounding error here. I know about the concept of how computers store numbers with floating decimal points. it might not be exactly 0,3" then it's good 👌
  • 1
    Sidenote: If the question of floating point was asked as a sneaky quick question that was hard to miss I would be fine with showing the candidate the answer and saying "How do you explain this" and if they said "Oh snap I forgot about floating point." and could explain it - I would be OK.

    Even better if the question could be extended into "So how WOULD you handle numbers in a program that needs to add dollars and cents" with an acceptable answer being storing a dollar int and a cent int, and a bonus being a discussion of types in various langs, like float vs decimal vs int - compared to the options in JS
Add Comment