Thursday, May 17, 2012

iOS interview Questions (Part 1)


I have seen lots of peoples asking on web about iOS interview questions. So I decided to gather up a list of iOS interview questions that could serve as a good starting point for Objective-C and Cocoa development topics. Also I intend to update this list later when i will have more information to add – hoping to build a comprehensive list of technical questions.Updated list available here in second part of tutorial.
So here I am with a list of possible iOS interview questions:

—- Objective-C related —-

  • identify basic OO concepts and the keywords Objective-C uses (interface, implementation, property, protocol, etc)
  • what is a designated initializer, what is the pattern for the initializers and why ( if (self = [super ...] ) )
  • basic memory management topics, like ownership retain/release/autorelease
    • what happens if you add your just created object to a mutable array, and you release your object
    • what happens if the array is released
    • what happens if you remove the object from the array, and you try to use it
  • trick: garbage collection on iPhone
  • autorelease pool usage
  • property declarations ( assign, nonatomic, readonly, retain, copy )
    • trick: ask about the nonexistent atomic keyword, what does atomic mean
    • ask on how to correctly implement a retaining setter property
    • ask about the circular reference problem and delegates being usually saved with assign rather then retain
  • what is the difference between the dot notation and using the square brackets
    • what happens when we invoke a method on a nil pointer
    • difference between nil and Nil
  • what is KVO and related theory + methods to use when observing
    • does KVO work with ivars too?
  • protocols – maybe: main difference between c#/java interface and protocols
    • what to do in a situation when a class doesn’t implement a method from a protocol
  • what about multiple class inheritance
  • what is fast enumeration
  • class methods vs instance methods
    • visibility of methods
  • what is an actual class in Objective-c (struct)
    • ask about the isa member
    • ask about isKindOfClass isMemberOfClass
  • root classes: NSObject, NSProxy
    • how does proxy-ing work
    • how to fake multiple class inheritance
  • id type
    • what happens during compilation if we invoke a method on an variable with the type id
    • what happens runtime if the method exists
    • what happens if the methods doesn’t exist
    • pro and cons of using the type id
    • what happens here(compile + runtime): NSString *s = [NSNumber numberWithInt:3]; int i = [s intValue];
  • what are class categories and the () category
  • what is an informal protocol
  • what is a delegate, how to create one, and use one
  • what is a selector, how to do a perform selector
    • how to delay executing a selector
    • what to do when the selector has more paramters (NSInvocation>
    • how to start a selector on a background thread
  • how to start a thread
    • what is the first thing to do on a thread (autorelease pool)
    • what is a runloop, and one very common place where it is used (timers, nsurlconnection)
  • how to download something from the internet
    • what is the difference between a synchronous and an asynchronous request
    • small task: explain how to download an image from the internet, and show this in an image view – all this after a button is tapped on the view
  • what are notifications, how to use them
  • what is a memory warning, how do we respond to it

—- A bit more advanced topics —-

  • when to use retainCount (never, and why)
  • why shouldn’t we invoke instance methods in an initializer and the dealloc
  • NSCoding, archiving
  • NSCopying, why can’t we simply use our own objects as key in a dictionary, what to do to solve the problem ( and the difference between a shallow and a deep copy)

—- UIKit related —-

  • what is a view, and a window
  • difference between a view’s bounds and frame
  • what is the resolution of the current available devices, difference between points and pixels (starting with iOS4)
  • what is the responder chain, becomeFirstResponder
  • what do IBOutlet and IBAction mean, what are they preprocessed to
  • how do tableviews function
  • what about multithreading and UIKit
  • what to do when the keyboard appears and hides some parts of the UI that are important
  • why should we release the outlets in viewDidUnload
  • what is awakeFromNib, what is the difference between a nib and a xib

—- CoreData —-

  • what is a context
  • what about multi threading and core data usage
  • what is an NSManagedObjectId – can we save it for later if the application was stopped
  • what types of stores does core data support
  • what is lazy loading, how does this relate to core data, situations when this can be handy
  • how to ready only a few attributes of an entity
  • what is an fetch result controller
  • how to synchronize contexts
  • how could one simulate an NSManagedObject (i’m thinking of the fact that all the properties are dynamic and not synthesized)
Okay – this probably is not a very organized list nor it is complete, but as i said i will get back and complete this list.
Also i would be really glad if you would drop a comment if you find this list useful, or want to add / correct something.

Followers