There's more than one way to do things PerlMonks

### Re: Stop with the interview questions already

by talexb (Canon)
 on Aug 30, 2009 at 16:25 UTC ( #792189=note: print w/replies, xml ) Need Help??

The company I work for has a standard Perl question that they ask developers. And when they asked me this question, I quickly dashed off a solution, which fell apart as soon as they asked me to explain it (awkward). I dropped that approach and did it another way, and was able to prove or explain that it would work. Phew.

I imagine that this question has leaked out, and there may have been applicants who have written the perfect response based on that advance knowledge. I seriously doubt that advance knowledge helped them. Any further exploration into Perl knowledge would clearly have left them high and dry.

I don't believe that software development is in a place now where you can 'fake it till you make it' -- you have to be able to have decent chops and be able to hit the ground running. You have to eat, live and breathe software.

Aside: I interviewed with Microsoft back in 1987, and the first of two interviews went great -- while the interviewer and I were waiting for the elevator to go back to the lobby for the second meeting, we were discussing the intriguing challenge of scheduling elevators, and he asked me what analog to that scheduling there might in computer systems. Without really pausing to think, I said, 'the position of a disk drive's head'. Yup.

The second interviewer and I just didn't click, and that was the end of that.

Cheating on interview questions is going to be a waste of time for both the underqualified employee and for the frustrated employer who has to downgrade and/or terminate the employee. That's not a good outcome.

But to get back to the original interview question -- if you're a developer, you should be familiar enough with binary, octal, decimal and hex, and with numbers in general, that you can do all sorts of cool tricks with numbers.

• Pounds to kilogramsKilograms to pounds? (1) Divide by 2.2 by halving then taking off ten percent. Other way? Add ten percent, then double it.
• Figure out a 15% tip? Take ten percent, then add half.
• Hex math? Jut the same as decimal math, except the ten times table is 2 1/2 times larger. (Extra challenge: try extracting the square root of a number in hex.)
• Dividing by 2 without using the divide function? You should really know that one, dear hearts.

Alex / talexb / Toronto

"Groklaw is the open-source mentality applied to legal research" ~ Linus Torvalds

1. Thanks to abell, I have finally fixed this pounds/kilograms mixup after two weeks. Can I blame dyslexia? I can? Sorry, my mistake.

• Comment on Re: Stop with the interview questions already

Replies are listed 'Best First'.
Re^2: Stop with the interview questions already
by Jenda (Abbot) on Aug 31, 2009 at 13:55 UTC

"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.

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.

Create A New User
Node Status?
node history
Node Type: note [id://792189]
help
Chatterbox?
 [LanX]: LOL I google for escaping POD commands and get hits for escape pods [choroba]: Programming is dangerous.

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (5)
As of 2018-03-24 12:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
Voting Booth?
When I think of a mole I think of:

Results (298 votes). Check out past polls.

Notices?