Anda di halaman 1dari 4

Random interview questions on

ObjectiveC, iOS & Core Data.


Objective-C questions
1. What is a category?
a. You use categories to define additional methods of an existing class—even
one whose source code is unavailable to you—without subclassing. You
typically use a category to add methods to an existing class, such as one
defined in the Cocoa framework
2. Can you have properties and ivars in a category?
a. No, Explanation
3. What is a protocol?
a. In Objective-C, a particular class only has one parent, and its parent has
one parent, and so on right up to the root object (NSObject). But what if
your class needs to call methods on objects outside of its parent tree?
A protocol is one way Objective-C solves this problem.
b. A protocol is a list of method declarations. If your class adopts the
protocol, then you have to implement those methods in your class.
4. What is formal and informal protocol?
a. An informal protocol is a category on NSObject, which implicitly makes
almost all objects adopters of the protocol.
b. A formal protocol declares a list of methods that client classes are
expected to implement. Formal protocols have their own declaration,
adoption, and type-checking syntax
c. Explanation
5. What is ARC (Automatic Reference Counting)?
a. ARC Unlike GC, it isn’t a background process and it removes the objects
asynchronously at runtime. But ARC doesn’t handle retain cycles; It is the
condition when 2 objects keep a reference to each other and are retained,
it creates a retain cycle since both objects try to retain each other, making
it impossible to release even though there are no external references. At
this point, you have a memory leak.
b. Is it garbage collection? No
c. Comparison
6. Difference between atomic and nonatomic properties? Explanation
7. Difference between strong and retain? Explanation
8. What is unsafe_unretained? Difference between unsafe_unretained, assign and
weak? Explanation
9. What does a copy property do? Explanation Is it deep copy or shallow copy?
Explanation
10. Does Objective-C have function overloading? Explanation
11. What is messaging? How does the runtime handle message passing? What is
message forwarding? Explanation
12. What is 'id'? Reference
13. What is performSelector:withObject:? What if I have to
performSelector:withObject: but pass 3-4 arguments to the method? (Hint:
NSInvocationOperation)
14. What is delegate? Can delegates be retained? Explanation
15. What is retain cycle? Explanation
16. Does ObjectiveC have multiple inheritance? Why not? How to imitate multiple
inheritance? Explanation
17. What is class extension? Why do we require them? Explanation
18. Who calls dealloc method? Can we implement dealloc in ARC? If yes, what is the
need to do that?
19. Write the setter method for a retained property. Example
20. Can you write a singleton class in ObjectiveC?
21. What is GCD ? What are advantages over NSThread?
22. What is NSOperation and NSOperationQueue?
23. How does dispatch_once manages to run only once?
24. What are blocks?
25. What are NSAutoreleasePool? When to use them?
26. Does a thread created using performSelectorInBackground:withObject: creates
its own autorelease pool?
27. An NSArray containing Employee model object which has properties like empId,
salary, age, designation, rating etc. Write a function that,
 Returns average salary
 Returns minimum age
 Returns maximum rating

iOS questions
1 What is the output binary format? Explain .app structure.
2 Can a static library (.a) contain resources like images, sound files etc?
3 What are lifecycle events of UIViewController?
4 Is UIKit thread safe?
5 Why do we override drawRect: method?
6 How do you check if your code has memory leaks?
7 What does static analyser do?
8 Concepts of notification center, local and remote notifications.
9 Have you uploaded app on Appstore? What is the process?
10 Difference between Developer and Enterprise Developer accounts?
11 Common reasons for app rejection from Appstore review process?

Few questions on CoreData which I may ask in an interview to some one brave enough
to venture :)

1 How do you setup/initialise a core data stack in your application? Is this activity
performed on main thread? If not, why?
2 What is NSPersistentStoreCoordinator? What duties does it perform?
3 What is NSPersistentStore? Is it thread safe?
4 What is NSManagedObjectContext? What are the different concurrency types?
Explain them.
5 Different types of persistent stores? Which all types can we have on iOS?
6 Can my application have multiple models? (Yes)
7 In a single model, can I have few entities in one sqlite db file and remaining in
another sqlite db file? (Yes, Hint: configurations)
8 What are the different store migration options? When are they used? How do they
work? What is mapping model?
9 Explain parent-child context setup. How does it work? What are the advantages?
10 What is difference between performBlock: and performBlockAndWait:?
11 Are the NSManagedObjectContext queues serial or concurrent?
12 Can you pass same core data objects between different threads and modify?
13 What performance issues can you face when using CoreData?
14 What is NSFetchedResultsController? How do you turn on content monitoring?
15 How to implement "load more" using NSFetchedResultsController? (Hint: Set
fetch offset and fetch limit on the NSFetchRequest of the controller, change the
request to fetch more results)
16 What are the different delete rules that a relationship can have? Which one takes
ownership?
17 In NSFetchRequest can we fetch only a selective few attributes of an entity? How?
18 Can I have relationship between entities in separate stores (in case of
configurations)? (No)
19 What are fetched properties? How do you create a fetched property?
20 What does $FETCH_SOURCE and $FETCHED_PROPERTY in the predicate
mean?
21 Why do all model object attributes get marked with @dynamic and not
synthesised? What does @dynamic mean?
22 When a NSFetchRequest fetches an entity object from store, does it fetch all of its
data at once?
23 What is a fault?
24 What are transient properties?

Anda mungkin juga menyukai