Interview Questions middle / senior iOS Developer

    We all went / go for interviews. Each time when preparing for the next interview, we look through the main topics, remember the questions that we were asked the previous time, or the questions that we ourselves asked. Below I want to introduce the main questions that often (based on personal experience) can be obtained from an interview for the position of middle / senior iOS Developer. So to speak, cheat sheet. At the same time, you can check your level of knowledge of the platform.

    General:
    - How is an abstract class different from an interface?
    - Tell us about the MVC pattern. What is the difference between a passive model and an active one?
    - Implementation of singleton in ARC and in non-ARC?
    - What other patterns do you know?
    - Write code that deploys a line in C ++.

    Networking & Multithreading:
    - What is deadlock?
    - What is livelock?
    - What is a semaphore?
    - What is a mutex?
    - Asynchrony vs multithreading. What is the difference?
    - Advantages and disadvantages of synchronous and asynchronous connections?
    - What does http, tcp mean?
    - What are the differences between HEAD, GET, POST, PUT?
    - What technologies in iOS can be used to work with streams. Advantages and disadvantages.
    - What is the difference between dispatch_async and dispatch_sync?
    - Will “Hello world” be displayed in the debugger? Why?
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        dispatch_sync(dispatch_get_main_queue(), ^{
            NSLog(@"Hello world");
        });
       /* Another implementation */
       return YES;
    }
    

    - What will be displayed in the console?
        NSObject *object = [NSObject new];
        dispatch_async(dispatch_get_main_queue(), ^
        {
            NSLog(@"A %d", [object retainCount]);
            dispatch_async(dispatch_get_main_queue(), ^
            {
                NSLog(@"B %d", [object retainCount]);
            });
            NSLog(@"C %d", [object retainCount]);
        });
        NSLog(@"D %d", [object retainCount]);
    

    CoreData:
    - What is Core Data?
    - In what cases is it better to use SQLite, and in which Core Data?
    - What is a Managed object context?
    - What is a Persistent store coordinator?
    - What are the nuances when using Core Data in different streams? How to synchronize data between threads?
    - Have NSFetchedResultsController been used? Why?

    Objective-C
    - What are the root classes in iOS? What are root classes for?
    - What is an isa pointer? What is it for?
    - What happens to the method after it was not found in the class object to which it was called?
    - How does a category differ from an extension (extention, unnamed category)?
    - Can ivar be added to the category?
    - When is it better to use a category, and when is inheritance?
    - What is the difference between using delagates and notifications?
    - How is the manual memory management in iOS?
    - autorelease vs release?
    - What does ARC mean?
    - What if the project is written using ARC, and you need to use the classes of a third-party library written without ARC?
    - Weak vs assign, strong vs copy?
    - Atomic vs nonatomic. What is the difference? How to manually override atomic / nonatomic setter in non-ARC code?
    - Why all the properties referring to strong / retain delegates. :)))
    - What is an autorelease pool?
    - How can I implement an autorelease pool in C ++?
    - What is the difference between NSSet and NSArray? Which operations happen quickly in NSSet and which in NSArray?
    - Formal vs informal protocol.
    - Are there any private or protected methods in Objective-C?
    - How to imitate multiple inheritance?
    - What is KVO? When should I use it?
    - What is KVC? When should I use it?
    - What are blocks? What are they needed for?
    - When do you need to copy a block? Who is responsible for this: caller or reciever?
    - What is designated initializer?
    - What is wrong with this code? Why do we need initializers?
    [[[SomeClass alloc] init] init];
    

    - How to delete an object during iteration through a loop?
    - Will the timer work? Why?
    void startTimer(void *threadId) 
    {
       [NSTimer  scheduleTimerWithTimeInterval:10.0f 
          target:aTarget 
              selector:@selector(tick: ) 
              userInfo:nil
               repeats:NO];
    }
    pthread_create(&thread, NULL, startTimer, (void *)t);
    

    - Which method will be called: class A or class B? How to change the code so that the class A method is called?
    @interface A : NSObject
    - (void)someMethod;
    @end
    @implementation A
    - (void)someMethod
    {
        NSLog(@"This is class A");
    }
    @end
    @interface B : A
    @end
    @implementation B
    - (void)someMethod
    {
        NSLog(@"This is class B");
    }
    @end
    @interface C : NSObject
    @end
    @implementation C
    - (void)method
    {
        A *a = [B new];
        [a someMethod];
    }
    @end
    

    - In what cases is it better to use strong, and in which copy for NSString? Why?
    @property (nonatomic, strong) NSString *someString;
    @property (nonatomic, copy) NSString *anotherString;
    

    - What will be displayed in the console? Why?
    - (BOOL)objectsCount
    {
        NSMutableArray *array = [NSMutableArray new];
        for (NSInteger i = 0; i < 1024; i++)
        {
            [array addObject:[NSNumber numberWithInt:i]];
        }
        return array.count;
    }
    - (void)someMethod
    {
        if ([self objectsCount])
        {
            NSLog(@"has objects");
        }
        else
        {
            NSLog(@"no objects");
        }
    }
    

    UIKit:
    - What is Run Loop?
    - What is the difference between frame and bounds?
    - What is a responder chain?
    - If I call performSelector: withObject: afterDelay: - will the message retain be sent to the object?
    - What are the conditions of the application?
    - How do push notifications work?
    - The life cycle of a UIViewController?
    - How is the processing of memory warning? Does processing depend on the version of iOS?
    - What is the best way to load UIImage from disk (from cache)?
    - Which content is best stored in Documents, and which in Cache?

    And what questions did you ask at the interviews?
    PS Thank you Vasily Mironchuk for assistance in the preparation of this material.

    Also popular now: