The startup company that I'm employed at is looking to open an office overseas, and I've been tasked with coming up with some reasonable questions that will be used use to help find/hire some suitable candidates to kickstart the new office. We are primarily looking for Android and iPhone developers, as well as a couple of team-leaders (preferably with Android/iPhone experience).
However, I'm really not a fan of using domain-specific questions as part of the interviewing process, so I'd very much like to avoid quizzing people about CoreData or Activity's or other platform-specific aspects. Instead I prefer Google's general approach of looking for people with solid knowledge of CS fundamentals.
With that in mind I've drafted up the following set of questions, and was hoping to get a bit of a peer review:
Language Agnostic Questions (A candidate is expected to do well on all of these)
Write a function that will convert a string to a double without calling any built-in utilities such as Double.parseDouble() or atof() or similar methods. You can assume that you input will always be well-formed, will always include a decimal point, and will always include at least one digit after the decimal point. You can implement your solution in the language of your choice, or using pseudo-code if you prefer.
Java template: http://ideone.com/clone/y2Q6S
Objective-C template: http://ideone.com/clone/JcOR5Free hint: To convert from a character to its integer value, you can do:
int charValue = character - '0';Write a function that will reverse a given string. You can assume that you input will not be null or empty. You can implement your solution in the language of your choice, or using pseudo-code if you prefer (This is a basic sanity-check type question. Any engineer with any sort of expreience should be able to come up with some bit of code that reverses a string. If they can't then that should be an indicator that they are not very good at all.).
Part 2: Write a function that uses the function you implemented above to test whether or not a given string is a palindrome (the same forwards as backwards).
Java template: http://ideone.com/clone/36BlH
Objective-C template: http://ideone.com/clone/GZbhaYou are reviewing the following code snippet submitted by a fellow engineer:
long fct(long n) { int q; int r = 1; while (n != 1); { r *= n; n--; } return r; }What feedback would you give them? Are there any errors in this code? If so, what are they, and can you provide some test-cases that will highlight them?
Language Specific Questions (A candidate is expected to do well on at least one of these)
Consider the following Java code snippet:
public static synchronized int add(int num1, int num2) { return num1 + num2; } public synchronized int add2(int num1, int num2) { return num1 + num2; } public int add3(int num1, int num2) { synchronized(this) { return num1 + num2; } }What is the difference between each method? Is one style preferred over the others? If so, which one, and why? What are the pros and cons of each style presented?
Consider the following Objective-C code:
@interface TestObj : NSObject { NSString* string1; } @property(nonatomic, assign) NSString* string2; @property(nonatomic, retain) NSString* string3; @end @implementation TestObj @synthesize string2, string3; - (void) processStrings { string1 = @"A new string"; string2 = [[[NSString alloc] initWithString:@"String 2"] autorelease]; self.string3 = [[NSString alloc] initWithString:@"String 3"]; [string1 release]; [string2 release]; [string3 release]; self.string2 = nil; string3 = nil; } @endWhat is the difference between string1, string2, and string3? Are there any problems with the way the strings are used in the processStrings method? If so, what are they, and how would you fix them?
For people who do well on these questions I also have a set of open-ended discussion questions that aren't posted here and which deal with things like complexity analysis, algorithms, hashing, optimization, and similar topics. I've used the open-ended questions on a number of candidates already and know that they do a good job of separating the talented engineers from the not so good ones.
Anyways, does that all seem reasonable?