first_page

Flippant Remarks about Job Interview Questions

In my ever-changing world, there interview questions that are well placed and worth my time and then there are ‘trick’ questions that are (to me) more of a personality test than a technical test (based on the technology actually used in the workplace). It is better to ask about personality directly in an interview rather than indirectly inquiring (either deliberately or out of ignorance). Adam is a Hash Table

These are the questions I’ve encountered (that I could not answer) over the last few weeks that are worth my time:

  • What is the difference between the Logical Tree and the Visual Tree? This question can be considered a fundamental WPF question—but it is the kind of question that only comes from experience with advanced scenarios—or by reading some extensive prose meditating on how WPF works. In 2007, Josh Smith does exactly that in “Understanding the Visual Tree and Logical Tree in WPF.” As Jason Dolinger of lab49 suggests in “Exploring the WPF Logical and Visual Trees,” the logical tree closely represents programmers intent (what is declared by the programmer in XAML) while the Visual Tree represents what WPF or Silverlight is doing under the hood to actually render what is intended.
  • What is _ViewStart.cshtml? I actually was very warm on this one. This is a great question to test for MVC3-level intimacy. I have not been working with MVC on a daily basis over the last three months so I’m not too upset for not getting this one.
  • What is the purpose of the yield keyword? This question opens a whole new subject of computer science under the heading “state machine”—according to stackoverflow.com: “Yield is implemented by the compiler as a custom class that implements a state machine.” Erik Forbes: “Yield is used to create implementations of the Enumerable pattern—a software pattern that allows you to treat a collection of things as an enumeration, over which you can perform some process.” MSDN: “The yield statement can only appear inside an iterator block, which can be implemented as the body of a method, operator, or accessor.” I really should know about this topic. No “excuses” here.
  • What is the difference between ref and out parameter modifiers? “…semantically, ref provides both ‘in’ and ‘out’ functionality, whereas out only provides ‘out’ functionality.” Where in refers to initializing the variable/parameter (with the expectation that it will be read inside the method accepting the parameter). This implies that out suggests that the parameter is write-only. I cannot think of a situation (outside of Interop and TryParse patterns) where using ref or out parameters are required. I prefer to use a struct or a class (stacking complexity vertically) over using multiple parameters (stacking complexity horizontally).
  • How can custom validation be centralized/reused by several view models? The CustomValidationAttribute accepts a Type and a method-name string where the Type points to a central validation class. I have actually written code using this kind of centralized custom validation—but clearly not enough to memorize this level of detail during a job interview.
  • What is the volatile keyword? “The volatile modifier is usually used for a field that is accessed by multiple threads without using the lock statement to serialize access. Using the volatile modifier ensures that one thread retrieves the most up-to-date value written by another thread.” My limited understanding of threading is a known issue—I was actually relieved to find out that this question was related to threading.

Here are some parlor-trick questions that are not really worth my time (but they are apparently worth serious money):

  • How would you swap the contents of two variables? I am unable to think of any real-world situation where I would need to do this. I actually got angry when I was asked this question—which prevented me from answering the question properly.
  • Given a LinkedList, with a head and a tail, how would you make the head a tail and the tail a head? I assume that the short answer here is to use the Reverse() method (see MSDN). When you can’t use Reverse(), then you can (ha, ha) swap the contents of the Next and Previous properties of LinkedListNode<T> in a state machine with null checks—null implying a head/tail. When this question was presented to me, I assumed that the head was at the top of a hierarchy (like a parent node) and the tail was the last child in this hierarchy—this caused me to shut down and short circuit at the whiteboard in more inappropriate fits of anger. (This question, by the way, was not asked of me within the last few weeks but about four months ago—before I took my last job.)
  • What is the difference between a Dictionary and a HashTable? As far as I’m concerned, a Dictionary supports generics and HashTable does not (it boxes values in object)—that’s the difference. The lack of generics support implies that HashTable is irrelevant to me for most of my work (but this may imply that I’m ignorant of the use of HashTable in distributed cache systems—used in the real world of high-traffic Web sites).

So the personality test that I’m failing is that I get angry when people f around with me—such that my anger prevents me from protecting myself. My anger causes me to go into a form a paralysis that renders me useless. When sadists sense this, they attempt to press my buttons with abandon.

Beyond the anger, some of these parlor trick questions are really tests that look for computer science training over, say, physics training. So here are some ‘pure’ computer science subjects I’m sensing out there:

  • The technical history of collections. (Who invented the LinkedList and why?)
  • Memorializing sort algorithms. (What is a bubble sort?)
  • Bitwise operations. (What is the [Flags] attribute used for?)

I do admit that these subjects are of little interest to me and I maintain that it is unfair to refuse to hire a person based almost entirely on whether they are knowledgeable in these areas. To me, you don’t hire a person that is not aware of, say, how MVC3 works intimately (which I have been guilty of). I am also guilty of being afraid of confrontation in these interviews (turning my anger against me)—what I should do is ask this question:

I do not understand this question, is there another one?

In the real world there should always be another question. The real world always operates in holistic diversity. There is no perfect, one way in real life. When my tester says no, there are no other questions, I should have the courage to politely conclude the interview, stand up and leave the building.

Related Resources

rasx()