Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Stop with the interview questions already

by Jenda (Abbot)
on Aug 31, 2009 at 13:55 UTC ( [id://792373]=note: print w/replies, xml ) Need Help??


in reply to Re: Stop with the interview questions already
in thread Stop with the interview questions already

"Dividing by 2 without using the divide function?". Sure, you write a function that converts the number to a string of "0"s and "1"s, then you chop() off the last digit and then you write a reverse conversion function. Or no? ;-)))

P.S.: I once faked it till I made it. Kinda. I was "borrowed" by my employer to another company temporarily as a "MS SQL professional". I've seen it for the first time about two days before that. They never found out and everyone was happy. I learned what I needed as I went along. It's about 12 years ago.

Jenda
Enoch was right!
Enjoy the last years of Rome.

  • Comment on Re^2: Stop with the interview questions already

Replies are listed 'Best First'.
Re^3: Stop with the interview questions already
by arun_kom (Monk) on Sep 09, 2009 at 09:15 UTC
    Stepping aside from this heavy discussion to a lighter moment ;) ... I guess an interview question like "How do you divide by 2 without using the divide function?" is probably not intended to test your knowledge but to test other desirable skills/qualities, and the way you answer it would tell something about your personality. Perhaps there is a wittier answer to it than the obvious "multiply by half" or the dull "not possible".

    Reminds me of this incident ... my brother was once asked this question towards the end of an interview for a programmer job,
    Q.: What is the probability of picking a red ball from a bag containing equal number of red and blue balls?
    A.: 0.5
    Q: Ok. How would you increase the probability of picking a red ball from the bag?"

    Without going into the theory of probability to explain that there wasn't a fair way to do so, he just replied jokingly, "Paint one of the blue balls red".

      I think the "divide by 2 without divide function" was meant to test whether the person knows about bit shifts. Bit shifting and bit masks are often overlooked and often very useful. And I am not speaking about microoptimizations by replacing division operators by bit shifts.

      Jenda
      Enoch was right!
      Enjoy the last years of Rome.

        Not to nitpick too much, but...

        Perhaps the only goal is to find out whether or not they know about shit-bifting, particularly if they'll be expected to optimize code on any sort of particular hardware.

        There's another potential motive, however. And that is whether or not candidates understand how it's possible to model real systems using discreet mathematics -- particularly that subset of discreet mathematics bounded by such things as bit-width.

        That Von Neumann was a real stinker.

        Cheers,
        Matt

        P.S. Speaking of discreet systems. Ever tried to figure out whether or not two integral functions intersect or not (or how often)? Euclid had it figured out. It's useful for figuring out potential solutions for diophantine systems of functions.

        Actually, if I were to ask "how to divide a number by 2 without the divide function", and someone would answer "by using the shift function", (s)he'll have to make up for it by answering other questions correctly, or (s)he'll not pass.

        The answer would have been correct if the question was "how to divide a non-negative even integer by 2". But the question said "number", without restricting the numbers.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://792373]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having a coffee break in the Monastery: (6)
As of 2024-04-23 11:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found