Archive for February, 2009


Uber Geek Challenge

IMHO far too many interviewers place a disproportionate amount of emphasis on language minutiae and familiarity of technology X, or latest trend Y during technical interviews. Instead, the interviewee should be given the opportunity to show you their problem solving capabilities (preferably through code). In the process of doing so you will get an idea not only about their cognitive faculties but also their coding standard and practices. Furthermore, if the problems dispensed are crafted to require certain knowledge the interviewee will clearly indicate if they possess that requisite knowledge OR are able to acquire it quickly if they make rapid progress after a little prompting.

With this in mind here's a list of language-agnostic questions that will challenge even the uber geek. Some of them are, admittedly, rather academic in nature and heavily biased towards mathematical knowledge but I make no apologies for that - it's an approach also taken by Amazon, Facebook, Google and numerous other industry heavyweights in their fight for the "best of the best" developers.

    General Programming

  1. How would you implement a 2-thread Peterson lock?
  2. What is a trampoline and how does it help achieve tail recursion?
  3. With regard to garbage collection explain how a semi-space, mark-and-sweep process works? Is that more efficient than Cheney's algo? What approach does Haskell use for GC?
  4. Which are worst- heisenbugs or mandelbugs ? Justify your answer.
  5. When would you consider the use of reverse Polish notation a good thing?
  6. Currying a dyadic function produces...?
  7. What's the difference between single and double dispatch ?
  8. Should strings be immutable in strongly-typed imperative languages?
  9. Explain how a vtable works.
  10. Explain the relationship between continuations and closures.
  11. What problems are amenable to memoization?
  12. Explain how duck typing gives you polymorphism without the need for inheritance.
  13. What's the subtle conceptual difference between streams and lists?
  14. How do logical and arithmetic shift bitwise operations differ?
  15. Many programming languages use twos-compliment to store negative numbers. Explain how this works.
  16. How can you circumvent the concurrent request limit in the HTTP 1.1 specification?
  17. Design

  18. What are the salient elements of recovery-oriented computing?
  19. Do you think a good design exhibits irreducible complexity? Explain your answer.
  20. Compare object composition to inheritance explaining the circumstances when one is preferred to the other.
  21. How does inheritance weaken encapsulation?
  22. What is orthogonal design?
  23. Rich or Anemic domain model - which do you prefer and why?
  24. Is adherence to the Open-Closed principle worth it?
  25. What developer practices can lead to Rube Goldberg machines?
  26. How is cyclomatic complexity calculated?
  27. What problem does the MVC/MVP/MVVM patterns solve? What problems do they introduce?
  28. Should you care if developers prefer Allman indenting over KR indenting in a C++ codebase?
  29. A component exhibits low efferent coupling and high afferent coupling. What does that imply about this component?
  30. Algorithms

  31. Name 3 algorithms that employ binary splitting?
  32. Is asymptotic notation still useful?
  33. What things might you try to improve speedup in an algorithm?
  34. When might you use the shunting yard algorithm?
  35. Is there a closed-form (non-recursive) solution to calculate the i-th Fibonacci number?
  36. When is an in-place algorithm undesirable?
  37. Can you name a cache oblivious algo?
  38. What's the best way to tally the number of set bits in a binary number?
  39. For what sort of problems would you use the Levenstein and Manhattan distances?
  40. What logic would you use to implement dead-code elimination in a compiler?
  41. Explain how Monte Carlo simulation can be used to approximate Pi.
  42. Assuming P != NP, which is worst - NP Hard or NP Complete ?
  43. Define a constant time, constant space, real-time algo to identify the dominant search term used across all queries of a search engine.
  44. Data Structures

  45. What's the difference between a B-tree and an R-tree?
  46. What sort of problems does transitive closure of directed graphs solve?
  47. When would you use an abstract syntax tree?
  48. Is there a way to store matrices so matrix multiplication operations achieve good locality of reference?
  49. Crypto

  50. Explain why XOR is useless as a mechanism to merge 2 disparate secret values in a secure fashion.
  51. In a memory-constrained device would you prefer the Sieve of Aitken or Erathosthenes?
  52. Give 3 ways to multiply really, really large integers using an arbitrary precision number system.
  53. Explain the Chinese remainder theorem.
  54. What does the Reimann Hypothesis say about the distribution of prime numbers?
  55. Name a probabalistic primality test?
  56. What's the time and space complexity of Euclid's algo?
  57. Why does modular exponentiation lend itself so well to crypto applications?
  58. Should Fermat's Last Theorem be called a theorem or a conjecture?
  59. How has the Fundamental Theorem of Arithmetic affected the development of crypto algorithms?
  60. Database Theory

  61. What benefits come from crafting idempotent database scripts?
  62. Deviations from 5NF - when should you do it?
  63. What's the difference between theta join and ansi join syntax?
  64. Do you consider MapReduce+BigTable+ChubbyLock to represent a distributed database?
  65. Would you rather scale out , or scale up a large database running a commercial RDBMS?
  66. If you were building a distributed database what functionality would be considerably harder to implement than that found in non-distributed databases?
  67. Do you think H-Store is likely to be a commercial success?
  68. Strategic

  69. Explain the impact of Metcalf's Law in measuring the utility of a social network.
  70. How is Metcalf's Law different from the principle of economies of scale?
  71. How does the iPhone application store "monetize the long tail"?
  72. Explain the theory of "wikinomics". How is it different from the wisdom of crowds?
  73. What's the value proposition for users of web-delivered services that store user data in "the cloud"?
  74. When is a "land grab" more appropriate than organic growth?
  75. How would you identify the critical mass, cost-value crossover point for a new IM service?
  76. Does the availability of cheap utility ("cloud") computing obviate the need for externally-raised seed funding for new SaaS offerings?
  77. How is Google's web-based mail service, GMail, differentiated from its' competitors offerings?
  78. Explain what split A/B testing is, and how the results should be utilised.
  79. What's the economic upper limit for user acquisition costs for a IM network with 10k users and per message revenue of .005 USD?
  80. Explain what founder's dilution is.
  81. What do you consider to be the "killer apps" of the past 10 years?
  82. Apart from reduced bandwidth costs, what are the benefits of employing a P2P network for application delivery?
  83. Explain why Microsoft Office is the dominant desktop word-processor / spreadsheet / presentation tool.
  84. At what point in a business can inelastic demand be exploited?
  85. Explain why major records labels view the sale of non-DRM digital music as a disruptive technology.
  86. Trivia (Not at all Appropriate for Interviews)

  87. What are these people famous for: James Gosling, Yukihiro Matsumoto, Grace Hopper, Bjarne Stroustrup, Anders Hejlsberg, Guido van Rossum, E.F. Codd, Simon Peyton-Jones, Alonzo Church.
  88. What's an Erdos Number?
  89. What IT entrepreneur had some success establishing a new lower bound on the solution to the burnt pancake problem?
  90. What IT entrepreneur has some success writing a lexer?
  91. Who was the entrepreneur who sold Hotmail to Microsoft?
Best of luck! I certainly had fun mentally walking through the responses I'd give.


Census Puzzle

Question: A census taker approaches a house and asks the woman who answers the door,"How many children do you have, and what are their ages?"

Woman: "I have three children, the product of their ages are 36, the sum of their ages are equal to the address of the house next door."

The census taker walks next door, comes back and says, "I need more information."

The woman replies, "I have to go, my oldest child is sleeping upstairs."

Census taker: "Thank you, I now have everything I need."

What are the ages of each of the three children?


Solution: It requires some basic maths but a dose of common sense at the end! Here's the solution...


Pop Quiz: Declared Accessibility in C#

What are the access modifiers available in C#?
Public, internal, protected, protected internal or private.

What is the difference between "protected" and "internal"?
Protected means within the same inheritance chain, internal means within the same assembly.

What access modifiers can be used against non-nested classes in C#?
Public or internal - the same goes for Interfaces. Note that non-nested classes cannot be private since it makes no sense for such classes to be private.

What access keywords can be used against nested classes in C#?
Public, internal or private.

What is the default accessibility of classes in C#?
Internal is the default if no access modifier is specified for a class and also for interfaces.

What access modifiers can be used against class members in C#?
Public, internal, protected, protected internal or private.

What is the default accessibility of class members in C#?
Private. Same goes for struct members.

Can you add access modifiers to interface members?
NO. The point of an interface is to describe a contract between an implementing type and users of the interface. Outside callers aren't going to care and shouldn't have to care about implementation. If an interface is public then every part of that contract has to be public, otherwise it would mean one thing to friend/internal classes and a different thing to everything else. If you need default implementation then it's best to use an abstract class.

Can you add access modifiers to Enum members?
NO. Enum members are always public, and so no access modifiers can be applied.

Does the "protected internal" access modifer mean OR or AND?
It means protected **OR** internal. Not both.

What is an "inconsistent accessibility" error?
A derived class, or a member function in another class that returns a type cannot expose a type with greater visibility than that defined in the class itself. It is a sign of a faulty design if this situation happens and the compiler tells you so.

What access modifiers can be used against structs in C#?
Public or internal. This is the same as non-nested classes.

What access modifiers can be used against struct member functions in C#?
Public, private, or internal. Note that struct members cannot be declared as protected because structs do not support inheritance.

How is a "Friend Assembly" created?
You can enable specific other assemblies to access your internal types by using the InternalsVisibleToAttribute. This attribute is applied to the AssemblyInfo.cs file of the assembly granting the permission, and takes a parameter indicating the assembly receiving the permission. Note that private member functions and types will still remain inaccessible to the friend assembly.

What access modifiers can be used against instance constructors in C#?
Any of the 5. Public, internal, protected, protected internal or private.

What access modifiers can be used against class destructors in C#?
None. It's not your call dude! The garbage collector owns this puppy.

What access modifiers can be used against user-defined operators in C#?
Only public. It makes no sense to redefine an operator for a given class or struct and then have an access modifier other than public on it.

What access modifiers can be used against delegates in C#?
The public, protected, internal, and private modifiers control the accessibility of the delegate type. Depending on the context in which the delegate declaration occurs, some of these modifiers may not be permitted.

What is the default accessibility of delegate types in C#?

Can namespaces have access modifiers?
No. All namespaces are implicitly public.

Next »