iOS Developer: how to be prepared for an interview

Sometimes my company needs to hire new iOS Developer and, in the last year, I was responsible for the interviews. I've found a lot of articles regarding how to do the perfect interview and (increase possibilities to) be hired, but no one on how the interviewer should prepare himself.
What do you need to survive?

The beginning of the interview is a critical part since everyone is nervous. The first thing to do is to ask something not directly related to the work in order to create a relaxed environment.
The first thing to make clear to the candidate is that it is impossible to know everything: calm down guys.

The entire interview process can be divided into 4 different parts:

  1. Preparation
  2. Candidate experience
  3. Technical questions
  4. Write and/or analyze a little iOS code snippet

Preparation

When I talk about preparation, I'm talking about myself: who does the interview needs to be well prepared about the candidate, so take your time to read his resume deeply and understand his experience.

Once finished, you already have a better understanding of the candidate's level and, based on the role you are searching for, have a general idea about him.
Of course, it is not a final decision, but the way the CV is written is a good point to create your personal idea about the candidate: check it in depth to find inconsistencies, programming languages, and technologies.

Usually, my expectation about the interview depends on the role itself:

  • Junior Developer: I search someone who knows how to resolve problems in a correct and elegant way.
  • Senior Developer: I search someone with all from the previous point and a deep understanding of the iOS ecosystem (languages, patterns, frameworks). It is not important to know everything, but a good base is required.
  • Team Lead: I search someone with all from the previous point and that has experience creating complex architectures for applications. Again, it is not important to know everything: the point is to have enough experience to choose the correct solution or to study/implement a new one when requested.

I've said it twice, but I'll make it even clear: I think that is not useful to find someone who knows only a few things requested for the role.
If someone has a good background, every language can be learned in a couple of weeks and can be managed in a couple of months.

Candidate experiences

This is the first thing I ask during the interview process: since it is something that the candidate knows, it helps him to feel comfortable and give you the time to check how it feels and changing your approach.
The first questions are not directly related to his skill, but I ask them to understand if the candidate has created a complex application in the past and what his role was.

This is the question list I usually ask and why:

Tell me something more about you
Nothing special to explain here.

Can you talk about your last mobile project?
With this question I'll try to make them comfortable, talking about something that they know and they have worked with.

What was your role in the project?
It is always important to know his role in order to avoid asking something they haven't seen: it's your job avoiding asking useless questions.

How many developers were involved?
A critical question: coming from a team with 6 iOS Developers, I always search for someone familiar with the concept of team work.

Technical questions

After breaking the ice it's the time to ask technical questions.
Your role is to make them feel comfortable, their role is to be prepared enough for the work they want to get.

A lot of ideas come from other blog posts I've read in the past: I think that no one comes already prepared, so reading and studying is always a good choice.

Tell me the difference between atomic and nonatomic. Which one is the default one?
With atomic the synthesized setter/getter method will ensure that the value is always returned regardless activity on any other thread.
If thread A is in the middle of the getter while thread B calls the setter, an autoreleased object will be returned to the caller in A.
With atomic you do not have any guarantees about thread safety.
With nonatomic you don't have this check, so nonatomic is faster than atomic.

What is the difference between ARC and MRC? Tell me the difference between strong, weak, assign
I think that every iOS Developer should manage correctly the memory, so please have a look at the Apple documentation: it won't be a waste of your time.

How can we respond to a low memory level in an application?
We can use the didReceiveMemoryWarning method, where we must clean up all we could in order to free up enough memory.

Can you tell me which design patterns have you used during your work, even if not directly present in the Apple ecosystem?
It is ok if the candidate doesn't know a lot of patterns, but I want to discuss at least about MVC, Delegation, Notification.
During my experience as iOS developer, I've used also: Singleton, Decorator, Factory, Injection... But I think I'm forgetting something 🙂 .
If you want to have a good introduction, have a look at this one by Ray Wenderlich: it is a very good entry point!

Write and/or analyze a little iOS code snippet

Blah blah blah: talking about iOS programming is interesting, but writing some code is what every developer loves.
I usually ask a couple of things, not so difficult, just to check how the candidate write code and resolve problems.

Write a method that accepts an array in input and returns the reverse of that array
I know that there exists a method that does exactly this, but I want to view the algorithm.
Here is a quick solution:

- (NSArray *)createReversedArray:(NSArray *)inputArray {
    NSMutableArray *reverseArray = [NSMutableArray array];

    for(NSInteger i = (array.count - 1); i >= 0; i--) {
        [reverseArray addObject: array[i]];
    }

    return [reverseArray copy];
}

I love this little snippet because it generates a new question based on the return:

  • If candidates returns [reverseArray copy], the question become: "Why did you returned the copy and no directly reverseArray (since NSMutableArray extends NSArray, it is possible)?".
  • If candidates returns reverseArray, the question becomes: "What happens if I cast the returned variable to NSMutableArray and I try to add another object? Why?"

Write a method that accepts an array of numbers in input and prints out min, max, average value
Here is a quick solution:

- (void)function:(NSArray *)array {
    if(!array || array.count == 0) {
        NSLog(@"Security check: empty array");
    }

    NSInteger min = [((NSNumber *)array[0]) integerValue];
    NSInteger max = [((NSNumber *)array[0]) integerValue];
    NSInteger total = 0;

    for(NSInteger i=0; i<array.count; i++) {
        NSNumber *tmpNumber = (NSNumber *)array[i];
        NSInteger tmpValue = [tmpNumber integerValue];

        if(tmpValue < min) { min = tmpValue; }
        if(tmpValue > max) { max = tmpValue; }

        total += tmpValue;
    }

    NSLog(@"MIN: %li", (long)min);
    NSLog(@"MAX: %li", (long)max);
    NSLog(@"AVERAGE: %lu", (total / array.count));
}

I know it is not the perfect one, but I prefer to be clear during interviews, specifying every variable type when needed.

Can you tell me what does the following code print out and why?
I love this one because it is a big bonus:

NSString *one = @"fooString";
NSString *two = @"fooString";

if(one == two) { NSLog(@"Same objects"); }
else           { NSLog(@"Different objects"); }

Normal answer (and the one who I accept): it prints "Different objects" because, in order to check if strings are equal, you need to use the method isEqualToString:.
We are checking the instance and since they are 2 strings, the check fails.

Correct. You know it, I know it... But it is wrong.

When the compiler reserves memory for immutable strings, it tries to optimize it: in this case, it won't create 2 different instances for 2 different string, it creates just 1 instance and will point both the NSString to that one.
So in the end, both strings will point to the same memory and to the same instance so the result is "Same objects".

I think you are now ready for an interview: enjoy it and, even if you won't take the job, use it to check your limit and understand what to study next time.

Happy interview,
M.

» Revision: 1