interview questions

Jul 31, 2011 at 3:13am
Does anyone have any links to code problems?

I am looking for code problems where the question is "What is wrong with this code?"

Or "What does this code output?"


I have the book "Cracking the Interview", but that only asks to write programs. I would like to get practice on debugging.

Any ideas?

Jul 31, 2011 at 9:31am
The book "How Not to Program in C++" is pretty good, if you can get past the attitude of the author. (it's interspersed with jokes, some good, some bad, some incredibly corny, and some completely nonsensical)

Besides that... you just want to practice coding. Small things can trip you up.

For example, if I asked you to list off as many differences as you could between a pointer and a reference, how many could you reach?

(that second tip is secondhand information. I don't interview people, but I've talked to someone who does)

And it never hurts to memorize an operator precedence table, just in case some jerk asks you to evaluate:
*n++*++q[2]
Jul 31, 2011 at 2:06pm
Honestly, if an employer asks me to evaluate *n++*++q[2], I prefer to not working with the programmers of the company...
Typical problems of type "What is wrong with this code?" ask about:
-polymorphism: train yourself by drawing a class hierarchy, some virtual methods and try to determine the actual method called on an object.
-parameters passing in function calls: references/pointers tricks. With practice these problems are easy.
Jul 31, 2011 at 2:41pm
closed account (DSLq5Di1)
NeuroFuzzy wrote:
And it never hurts to memorize an operator precedence table, just in case some jerk asks you to evaluate:
*n++*++q[2]

Or how the "goes to" operator works!
http://stackoverflow.com/questions/1642028/what-is-the-name-of-this-operator
Jul 31, 2011 at 7:15pm
This thread might be of interest, too?

http://stackoverflow.com/questions/50447/favorite-c-interview-question

Includes comments from people who do interviews!
Aug 29, 2011 at 10:32am
Thanks for your link! It's interesting.
Topic archived. No new replies allowed.