Search Your Question

Multiple option interview questions

What is the first method called in the iOS App initialisation flow? & what is the return type?
  • Main, , Return the is void.
  • App Delegate, Return type is Bool
  • UIApplicationMain, Return type is Bool
  • Main, Return type is int.

What is the parent class of App Delegate?
  • UIResponder
  • NSObject
  • UIApplicationMain
  • UIKit

What is the difference between [Foo new] and [[Foo alloc] init]?
  • New will not always initialize the object.
  • New is significantly faster than alloc + init.
  • None, they perform the same actions.
  • New does not exist in Objective-C.

What happens at runtime with the following :
    NSObject *obj1 = nil;
    NSObject *obj2 = [obj1 copy];
    NSLog(@"value of object 2  %@",obj2);
  • Application crashes with “SIGABRT”
  • Application continues, but issues “cannot access nil object reference” warning
  • Object 2 is instantiated as an NSObject with nil Values
  • Log prints “(null)” and continues as usual

What is the object.toString equivalent in Objective-C?
  • [NSObject toString];
  •  [NSObject description];
  • [NSObject stringWithFormat];
  •  [NSObject getDescription];

The format for a NSPredicate is the same as a Regular Expression
  • True
  • False

What can happen if you use “self” inside a block?
  • None of the above.
  • Self can become dangling pointer.
  • You can create a retain cycle.
  • By the time the block executes, self can be pointing to a different object[NSObject toString]

What is @dynamic directive meaning in iOS?
  • The @dynamic directive generates the accessor methods for you at compile time.
  • The @dynamic directive tells the compiler that you will provide accessor methods dynamically at runtime.
  • The @dynamic directive generates a getter method for your property at compile time.
  • The @dynamic directive generates a getter method for your property at run time.

You can use %@ to specify a dynamic property
  • True
  • False

What is difference between #import and #include?
  • #import ensures that a file is only ever included once, and #include allows the same thing.
  • None, they do the same thing.
  • #include is not valid syntax.
  • #include ensures that a file is only ever included once and #import permits the file to be included many times.

A UIView is a superclass of:
  • UIViewController
  • UIWindow
  • UIImage
  • UILabel
  • UIScreen

A method and a variable can have the same name in Objective C.
  • True
  • False

What framework is KVO (Key Value Observing) a part of?
  • Foundation
  • UIKit
  • CoreData
  • UIKItCore

What class method is used to make an NSArray from NSData class?
  • NSArray arrayWithObject:
  • NSArray dataWithContentsOfFile:
  • NSData dataWithContentsOfFile:
  • NSKeydUnarchiver unarchiveObjectWithData:

In Core Data, what is the name of the object representation for the database schema?
  • NSManageObjectContext
  • NSManagedObjectModel
  • NSEntityDescription
  • NSManagedObject

What’s the difference between “nil” and “NULL” ?
  • nil is a literal null value for Objective-C instances. NULL is object used to represent null.
  •  nil is a literal null value for Objective-C instances. NULL is literal null value for Objective-C classes.
  • Nil is a literal null value for Objective-C instances. NULL is literal null value for C pointers.
  • NULL is literal null value for Objective-C instances. Nil is literal null value for C pointers
  • they are the same thing


Which of the following is Singleton class?
  • NSFileManager
  • UIApplication
  • NSFileManger & UIApplication
  • NSArray & NSDictionary
  • NSString & NSOperations

What is the output of the below program?

    NSMutableString *tempString = [NSMutableString stringWithString:@"1"];
    dispatch_async(dispatch_get_main_queue(), ^{
        [tempString appendString:@"2"];
        NSLog(@"%@",tempString);
    });
    [tempString appendString:@"3"];
    NSLog(@"%@",tempString);


  • Log prints “13” & “132” and continues as usual.
  • Log prints “12” and then we will have a deadlock here because the main queue will block.
  • Log prints “123” and continues as usual.
  •  Log doesn’t print anything. It’s deadlock here because the main queue will block on the call to dispatch_async.

What is the output of the below program?

    NSMutableString *tempString = [NSMutableString stringWithString:@"1"];
    dispatch_sync(dispatch_get_main_queue(), ^{
        [tempString appendString:@"2"];
        NSLog(@"%@",tempString);
    });
    [tempString appendString:@"3"];
    NSLog(@"%@",tempString);
  • Log prints “13” & “132” and continues as usual.
  • Log prints “12” and then we will have a deadlock here because the main queue will block.
  • Log prints “123” and continues as usual.
  •  Log doesn’t print anything. It’s deadlock here because the main queue will block on the call to dispatch_async.

What is used to sort Core Data results?
  • NSSort
  • NSCoreDataSort
  • [self sort]
  • NSSortDescriptor
  • NSPredicate

Note : Answer is written in Bold.

No comments:

Post a Comment

Thanks