Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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)

  1. 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/JcOR5

    Free hint: To convert from a character to its integer value, you can do:

    int charValue = character - '0';
  2. 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/GZbha

  3. You 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;
        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)

  1. 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?

  2. Consider the following Objective-C code:

    @interface TestObj : NSObject {
        NSString* string1;
    @property(nonatomic, assign) NSString* string2;
    @property(nonatomic, retain) NSString* string3;
    @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;

    What 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?

share|improve this question

closed as too broad by MichaelT, jwenting, GlenH7, Bart van Ingen Schenau, gnat Jun 16 '14 at 8:29

There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs. If this question can be reworded to fit the rules in the help center, please edit the question.

It seems like you've already determined your questions, and even determined that some are good for finding the kind of people you want to hire. Exactly what are you looking for? –  Thomas Owens Aug 2 '11 at 12:00
@Thomas - Peer review, primarily. Confirmation that my questions are reasonable and adequately challenging to help find qualified developers and/or suggestions on how to improve them, add new questions, and so on. And also opinions (with justifications) about whether I should include more domain-specific questions would be welcome, if anyone has any to share. –  aroth Aug 2 '11 at 12:06
I don't understand the synchronized "add" methods. Why would you synchronize a method that doesn't change any data? You should come with a more realistic example. –  kevin cline Aug 2 '11 at 16:35
Converting a decimal string to the closest double is pretty hairy. I could spend a day thinking about the corner cases, like "99999999999999999999999999999999999999999999999999999" and "0.000000000000000000000000000000000000000000001". Are you looking for candidates who understand that? Do you? If not, then I would pick a different problem. –  kevin cline Aug 2 '11 at 16:44

3 Answers 3

This looks ok, however I don't find it suitable for team leaders. I guess you need to change questions for lead level, for that you may include some real life scenarios and design approach for the same. You may think of including questions usage of design patterns and anti patterns. Under language specific questions you can include questions on latest things in Java and Andriod like NFC, concurrent programming, New changes JDK7.

share|improve this answer
For android lead, you can give an offline assignment to create an android application. Later you interview panel and review that and interview questions. –  sudmong Aug 2 '11 at 12:27
Thanks, I agree, there should be some additional questions specific to the leadership-level roles. Giving an offline assignment is an interesting idea, but how could it be structured so as to be fair and repeatable? Is the idea that we would say what the project should do? Or if not then how should we effectively guard against the candidate finding some project online and trying to pass it off as their own? –  aroth Aug 2 '11 at 23:05
That will be simple.. An assignment can be given to them. for Android, it could be a TODOs manage application. For Java, 1. it could be an application for searching a line from folder/files 2. It could be a survey application. The intention will be to see their problem solving and design approach. It has nothing to do actual usage and execution of the program. –  sudmong Aug 3 '11 at 5:29

Two things that I would add.

Your Java question is just that, a Java question. If you are looking for Android developers, especially an experienced Android developer, you should ask Android-specific questions. The same goes for the Objective-C question. Knowing Java or Objective-C might be acceptable for some positions, as I would suspect that someone who knows one of the languages can learn the frameworks and stacks used in Android and iOS (and probably even the other language and its frameworks, too), but you probably don't want a senior developer to be learning the frameworks on the job (especially if they were initially hired to work in those frameworks).

I'm not sure what the other questions you are asking are, but I've rarely been asked questions from this list of 100 Interview Questions for Software Developers. For me, with a software engineering background, I'm competent and knowledgable in things like requirements engineering, design and architecture, configuration management, project management, and best practices, but I'm rarely asked those questions. The majority of questions are about implementation, algorithms, and data structures - perfect for a computer scientists, not so much for a software engineer with a system-level view of software development.

share|improve this answer
Yes, my thinking with the language questions was that since Android follows patterns common in other Java API's identifying people with solid Java skills should be enough, except perhaps for senior-level/team-lead roles. And for Objective-C I don't think it's terribly common for people to work in that language unless they are coding for Mac/iPhone. Would you agree with that assessment? And we'll probably include some conceptual questions like the ones in your link, but primarily for the leadership roles. For the other roles we want strong coders, but not necessarily architects or leads. –  aroth Aug 2 '11 at 23:13
@aroth For Objective-C and the Mac/iOS world, I can't speak to that. I've never done any development in that environment. As far as the conceptual questions, you should ask some to everyone. You don't want just a coder, but someone who you can grow into various positions into your organization over the course of years. You need to start thinking about minimizing turnover and grooming future leadership early on. Sure, they might not be up to it yet, but you want someone who has the skills to become a leader in the future. –  Thomas Owens Aug 2 '11 at 23:48

Some of these problems have problems.

  1. Converting a decimal string to the closest double is pretty hairy. I could spend a long while thinking about how to do this correctly. Just multiplying or dividing by 10 and adding will produce incorrect results for many inputs, perhaps most of them. For example, at some point, the space between consecutive doubles is 2^5 = 32. So imagine that 3200 is representable, and so is 3232, but no intermediate number. Now imagine converting "3219" to double:

    • ...
    • 32 x 10 => 320
    • 320 + 1 => 321
    • 321 x 10 => 3210, rounded down to 3200
    • 3200 + 9 => 3209, rounded down to 3200.

    Are you looking for candidates who understand that the obvious method fails? BTW, it fails for signed integers too.

  2. I don't understand the synchronized "add" methods. Why would you synchronize a method that doesn't change any data? You should come with a more realistic example if that is not the sort of answer you are seeking.

  3. Why would you abbreviate "factorial" to "fct" ? Or is that part of the question?

share|improve this answer
1) It doesn't ask for the "closest" double. Any reasonable value is fine. The focus is on whether the candidate can break a complex problem down into manageable chunks and come up with a reasonable algorithm. If they understand the precision issues then they can have bonus points. 2) To see if the candidate recognizes the difference between "static synchronized", "synchronized" and a synchronized block, and the pitfalls particularly of the first option. 3) Yes, the terrible naming convention is part of the question. –  aroth Aug 2 '11 at 23:27
@aroth: I understand the point of the "synchronized" question, but your example is poor. You should create methods that actually have a need for synchronization. Otherwise candidates will be distracted by the fact that the code doesn't require synchronization. Also, regarding the "convert string to double" question, I think you should pick a problem that will give the candidate a chance to produce correct code, not "sort-of" correct code. Good candidates may spend a long time thinking about the correct way to convert string to double, so you won't get any useful information. –  kevin cline Aug 3 '11 at 15:44

Not the answer you're looking for? Browse other questions tagged or ask your own question.