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).
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
yieldkeyword? 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
outparameter modifiers? ââŠsemantically,
refprovides both âinâ and âoutâ functionality, whereas
outonly 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
outsuggests that the parameter is write-only. I cannot think of a situation (outside of Interop and
TryParsepatterns) where using
outparameters 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
Typeand a method-name string where the
Typepoints 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
volatilekeyword? â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
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
HashTable? As far as Iâm concerned, a
Dictionarysupports generics and
HashTabledoes not (it boxes values in
object)âthatâs the difference. The lack of generics support implies that
HashTableis irrelevant to me for most of my work (but this may imply that Iâm ignorant of the use of
HashTablein 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
- 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.
- âWhy Dictionary is preferred over hashtable in C#?â
- âThe Beginnerâs Guide to Using Enum Flagsâ
- âASP.NET Web Forms Interview Questionsâ
- âBeing More Professional about Referring to ASP.NET Web Formsâ
- âCareful Remarks about My (Microsoft-based) IT Job Marketâ
- âIâm too uptight during the job interviewâŠâ