Mital Solanki
Senior iOS Application Developer
Email : [email protected]
[email protected]
Senior iOS Application Developer
Email : [email protected]
[email protected]
Basics of C / C++
(1) What is Object?
Ans : Object is the basic unit of object-oriented programming. Objects are identified by its unique name.
(2) What is Method?
Ans : An Object is a collection of data members and associated member functions also known as methods.
(3) What is Class?
Ans : Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class.
For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Colour, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created.
(4) What is Data Encapsulation?
Ans : The wrapping up of data and its functions into a single unit is called Encapsulation. Data Encapsulation, data is not accessed directly, it is only accessible through the functions present inside the class.
Example : cars and owners -- all the functions of cars are encapsulated with the owners, No one else can access it.
(5) What is Data Abstraction?
Ans : Data Abstraction increases the power of programming language by creating user defined data types. Data Abstraction also represents the needed information in the program without presenting the details..
Abstraction refers to the act of representing essential features without including the background details or explanation between them.
For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.
(6) What is Inheritance ?
Ans : Inheritance is the process of forming a new class from an existing class or base class. The base class is also known as parent class or super class, the new class that is formed is called derived class.
Example : grandfather - father - son
(7) What is Polymorphism?
Ans : The ability to use an operator or function in different ways in other words giving different meaning or functions to the operators or functions is called polymorphism. Poly refers to many. That is a single function or an operator functioning in many ways different upon the usage is called polymorphism.
Example : a door to a temple, a door to a house, a door to a kitty house --- all are doors, but all looks different.
(8) What is Method Overloading?
Ans : Overloading is when you define two methods with the same name in the same class but with different signatures.
(9) What is Method Overriding ?
Ans : Overriding is when you redefine a method that has already been defined in a parent class with there same signature.
(10) What is Private, Protected & Public ?
Ans : private - limits the scope class variable to the class that declares it.
protected - Limits instance variable scope to declaring and inheriting classes.
public - Removes restrictions on the scope of instance variables
(11) What is constructor?
Ans : A Class constructor is a special member function of a class that is executed whenever we create new objects of that class.
(12) What is destructor?
Ans : A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the delete expression is applied to a pointer to the object of that class.
Ans : Object is the basic unit of object-oriented programming. Objects are identified by its unique name.
(2) What is Method?
Ans : An Object is a collection of data members and associated member functions also known as methods.
(3) What is Class?
Ans : Classes are data types based on which objects are created. Objects with similar properties and methods are grouped together to form a Class.
For example consider we have a Class of Cars under which Santro Xing, Alto and WaganR represents individual Objects. In this context each Car Object will have its own, Model, Year of Manufacture, Colour, Top Speed, Engine Power etc., which form Properties of the Car class and the associated actions i.e., object functions like Start, Move, Stop form the Methods of Car Class.No memory is allocated when a class is created. Memory is allocated only when an object is created, i.e., when an instance of a class is created.
(4) What is Data Encapsulation?
Ans : The wrapping up of data and its functions into a single unit is called Encapsulation. Data Encapsulation, data is not accessed directly, it is only accessible through the functions present inside the class.
Example : cars and owners -- all the functions of cars are encapsulated with the owners, No one else can access it.
(5) What is Data Abstraction?
Ans : Data Abstraction increases the power of programming language by creating user defined data types. Data Abstraction also represents the needed information in the program without presenting the details..
Abstraction refers to the act of representing essential features without including the background details or explanation between them.
For example, a class Car would be made up of an Engine, Gearbox, Steering objects, and many more components. To build the Car class, one does not need to know how the different components work internally, but only how to interface with them, i.e., send messages to them, receive messages from them, and perhaps make the different objects composing the class interact with each other.
(6) What is Inheritance ?
Ans : Inheritance is the process of forming a new class from an existing class or base class. The base class is also known as parent class or super class, the new class that is formed is called derived class.
Example : grandfather - father - son
(7) What is Polymorphism?
Ans : The ability to use an operator or function in different ways in other words giving different meaning or functions to the operators or functions is called polymorphism. Poly refers to many. That is a single function or an operator functioning in many ways different upon the usage is called polymorphism.
Example : a door to a temple, a door to a house, a door to a kitty house --- all are doors, but all looks different.
(8) What is Method Overloading?
Ans : Overloading is when you define two methods with the same name in the same class but with different signatures.
(9) What is Method Overriding ?
Ans : Overriding is when you redefine a method that has already been defined in a parent class with there same signature.
(10) What is Private, Protected & Public ?
Ans : private - limits the scope class variable to the class that declares it.
protected - Limits instance variable scope to declaring and inheriting classes.
public - Removes restrictions on the scope of instance variables
(11) What is constructor?
Ans : A Class constructor is a special member function of a class that is executed whenever we create new objects of that class.
(12) What is destructor?
Ans : A destructor is a special member function of a class that is executed whenever an object of it's class goes out of scope or whenever the delete expression is applied to a pointer to the object of that class.
Basics of Objective C
(1) What is Objective C?
Ans : Objective-C is a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language. strictly superset of c.
(2) What is Cocoa & Cocoa Touch?
Ans : Cocoa is for Mac App development and cocoa touch is for apples touch devices - that provide all development environment.
(3) Who invented Objective c?
Ans : Broad cox and Tom Love
(4) Difference between id and void.
Ans : id means "a reference to some random Objective-C object of unknown class" & void means "a reference to some random chunk of memory with untyped/unknown contents".
(5) Difference between nil, Nil & Null.
Ans : nil represent Null-pointer to objective- c object, NIL represent Null-pointer to objective- c class & null represent null pointer to primitive type or absence of data.
(6) Difference between #Define & Static Const.
Ans : #define is a preprocessor macro. The preprocessor will replace every occurrence before the compiler is started. It's not a variable, it's just sort of an automatic find-and-replace mechanism.
static const is a "real" variable that is constant (can't be changed after declaration). Static means that it will be a shared variable across multiple calls to that block.
(7) Difference between Atomic & Nonatomic.
Ans : Atomic means only one thread access the variable(static type). Atomic is thread safe but it is slow in performance.
Nonatomic means multiple thread access the variable(dynamic type). Nonatomic is thread unsafe but it is fast in performance.
(8) Difference between Strong & Retain.
Ans : In a non-ARC project "strong" will act as "retain". In an ARC project "retain" might work if clang doesn't flag an error (i dont use ARC), but theres a subtlety in the description.
Retain says - I'm holding on to this object, until I'm ready to release it & Strong says - ARC treat this as a retained object and insert some generated code in my dealloc method to be released when the autorelease pool drains.
(9) Difference between Assign, Retain & Copy.
Ans : "assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes.
"retain" is needed when the attribute is a pointer to an object. The setter generated by @synthesize will retain (aka add a retain count) the object. You will need to release the object when you are finished with it.
"copy" is needed when the object is mutable. Use this if you need the value of the object as it is at this moment, and you don't want that value to reflect any changes made by other owners of the object. You will need to release the object when you are finished with it because you are retaining the copy.
(10) Difference between Readwrite & Readonly.
Ans : "readwrite" is the default. When you @synthesize, both a getter and a setter will be created for you.
"readonly", no setter will be created. Use it for a value you don't want to ever change after the instantiation of the object.
(11) What is Property?
Ans : An object’s properties let other objects inspect or change its state. But, in a well-designed object-oriented program, it’s not possible to directly access the internal state of an object. Instead, accessor methods (getters and setters) are used as an abstraction for interacting with the object’s underlying data.
(12) What is Protocol?
Ans : A protocol is a group of related properties and methods that can be implemented by any class. They are more flexible than a normal class interface, since they let you reuse a single API declaration in completely unrelated classes.
(13) Difference between @synthesize & @dynamic.
Ans : @synthesize will generate getter and setter methods for your property.
@dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass)
(14) What is Category ?
Ans : A category allows you to add methods to an existing class—even to one for which you do not have the source.
(15) Difference between Deep Copy & Shallow Copy.
Ans : Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.
Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the original collection duplicated.
(16) Difference between Heap & Stack.
Ans : Stack - The stack is a region of memory which contains storage for local variables, as well as internal temporary values and housekeeping. On a modern system, there is one stack per thread of execution. When a function is called, a stack frame is pushed onto the stack, and function-local data is stored there. When the function returns, its stack frame is destroyed. All of this happens automatically, without the programmer taking any explicit action other than calling a function.
Heap - The heap is, essentially, everything else in memory. Memory can be allocated on the heap at any time, and destroyed at any time. You have to explicitly request for memory to be allocated from the heap, and if you aren't using garbage collection, explicitly free it as well. This is where you store things that need to outlive the current function call. The heap is what you access when you call malloc and free.
(17) Difference between Datasource & Delegate.
Ans : The datasource supplies the data, the delegate supplies the behavior.
(18) Difference between NSNotification & Delegate.
Ans : Notification is used to broadcast messages to possibly several recipients unknown from the sender.
Delegation is used to send messages to a single known recipient acting on behalf of the sender.
(19) Difference between Asynchronous & Synchronous request.
Ans : Asynchronous never block the main thread waiting for a network response.
Synchronous blocks main thread until they complete request.
(20) Difference between Release & Autorelease.
Ans : release - destroy the object from memory
autorelease - destroy the object from memory in future when it is not in use.
(21) Describe View Controller's life cycle.
Ans : Load View > View Did Load > View Will Appear > View Did Appear > View Will Disappear > View Did Disappear > View Did Unload.
(22) Describe Application's life cycle.
Ans : ApplicationDidFinishLaunchingWithOption > ApplicationWillResignActive > ApplicationDidBecomeActive > ApplicationWillTerminate
(23) What is NSThread ?
Ans : An NSThread have an Objective-C method run in its own thread of execution. Threads are especially useful when you need to perform a lengthy task, but don’t want it to block the execution of the rest of the application. In particular, you can use threads to avoid blocking the main thread of the application, which handles user interface and event-related actions. Threads can also be used to divide a large job into several smaller jobs, which can lead to performance increases on multi-core computers.
(24) what is use of NSOperation? how NSOperationque works?
Ans : An operation object is a single-shot object—that is, it executes its task once and cannot be used to execute it again. You typically execute operations by adding them to an operation queueAn NSOperationQueue object is a queue that handles objects of the NSOperation class type. An NSOperation object, simply phrased, represents a single task, including both the data and the code related to the task. The NSOperationQueue handles and manages the execution of all the NSOperation objects (the tasks) that have been added to it.
(25) what is use of NSCoder? how initWithCoder works?
Ans : The NSCoder class is used to archive/unarchive (marshal/unmarshal, serialize/deserialize) of objects. This is a method to write objects on streams (like files, sockets) and being able to retrieve them later or in a different place.
(26) Define Push Notification.
Ans : Push notification, also called server push notification, is the delivery of information from a software application to a computing device without a specific request from the client.
(27) Difference between Mutable & Immutable.
Ans : A mutable object can be mutated or changed. An immutable object cannot. For example, while you can add or remove objects from an NSMutableArray, you cannot do either with an NSArray.
The advantages of your mutable objects is obvious, but they should only be used when necessary (which is a lot less often than you think) as they take up more memory than immutable objects.
(28) How To Submit Your App To the App Store _.
Ans : 1. Create a distribution provisioning profile for your app.
2. Build an archive of your app with that profile.
3. Create an app listing in iTunes Connect and fill in all of the metadata and screenshots.
4.Submit your app for certification through Xcode.
(29) How many types of iOS Developer program are available?
Ans : iOS Developer - For individuals and organizations creating apps for distribution on the App Store. it's cost $99 / year.
iOS Developer Enterprise - For companies and organizations distributing proprietary apps for internal use. it's cost $299 / year.
iOS Developer University - For higher education institutions introducing iOS app development into their curriculum. it's cost Free.
(30) Describe Types of In-App Purchase.
Ans : Consumable - You need to purchase these items every time you want them, and you can't download them again for free. example : Extra health, Extra experience points.
Non-consumable - You purchase these items one time, and you can transfer them to multiple devices authorized with the same iTunes Store account. example : Bonus game levels, City guide maps.
Non-renewing subscriptions - You can purchase these items again after the subscription period ends. example : One-month subscriptions, Location service subscriptions.
Auto-renewable subscriptions - You can purchase these items with different renewal periods. example : Weekly newspaper subscriptions, Weekly magazine subscriptions.
(31) Which compiler used in latest Xcode?
Ans : LLVM ( Low Level Virtual Machine )
(32) Which debugger used in latest Xcode?
Ans : LLDB
(33) Difference between Frame & Bounds.
Ans : The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
(34) Define Screen Size of iOS Device.
Ans : iPhone 4 / 4s : 320px * 480px
iPhone 5 : 320px * 568px
iPad : 768px * 1024px
(35) What is storyboard?
Ans : A storyboard is a visual representation of the user interface of an iOS application, showing screens of content and the connections between those screens.
(36) What is interface & implementation?
Ans : Interface declares the behavior of class and Implementation defines the behavior of class.
(37) Type of data storage in iOS.
Ans : SQLite, CoreData, PropertyList File, JSON / XML File, Array / Dictionary.
(38) Difference between Absolute and Relative path.
Ans : A relative path is going to be a structure based around a root node and an absolute path is going to be a structure based on a non ambiguous location.
(39) Which are basic framework of iOS App Development?
Ans : Foundation.framework, CoreGraphics.framework, UIKit.framework
(40) How to find the memory leaks in MRC?
Ans : Static analyzer, Instrument.
(41) Third party tool for reporting crash log.
Ans : Crashlytics, Crittercism, Bugsense, TestFlight, HockeyApp.
(42) Define MVC.
Ans : MVC stands for Model View Controller, and it is a pattern that allows developers to differentiate code depending on three different roles. It is extremely popular due to its simplicity and it is implemented in different ways in almost every single technology out there -in different ways though. MVC helps you making your code lot more reusable, maintainable and easier to extend.
The three roles are :
(1) Model : The object that holds your application data and defines how to manipulate it.
(2) View : The objects that are in charge of the visual representation of the Model and the controls the user can interact with; basically, all the UIViews and their subclasses.
(3) Controller : The controller is the mediator that coordinates all the work. It accesses the data from the model and displays it with the views, listens to events and manipulates the data as necessary.
(43) Difference between Instance and Class method.
Ans : Class method : It does not need you to allocate instance of that object to use / process it. It is self contained and can operate without any dependence of the state of any object of that class. It is expected to allocate memory for all its own work and deallocate when done, since no instance of that class will be able to free any memory allocated in previous calls to the class method.
Instance method : It is just the opposite. You cannot call it unless you allocate a instance of that class. Its like a normal class that has a constructor and can have a destructor (that cleans up all the allocated memory).
(44) Define GCD.
Ans : Grand Central Dispatch (GCD) dispatch queues are a powerful tool for performing tasks. Dispatch queues let you execute arbitrary blocks of code either asynchronously or synchronously with respect to the caller. You can use dispatch queues to perform nearly all of the tasks that you used to perform on separate threads. The advantage of dispatch queues is that they are simpler to use and much more efficient at executing those tasks than the corresponding threaded code.
(45) Outline the class hierarchy for a UIButton until NSObject
Ans : UIButton inherits from UIControl > UIControl inherits from UIView > UIView inherits from UIResponder > UIResponder inherits from the root class NSObject.
(46) Is this possible to save image in string?
Ans : yes. As a Unicode or base64string.
(47) Difference between ARC and Garbage Collection.
Ans : automatic reference counting, objects are still deallocated as soon as they go out of scope.
garbage collection, objects can remain in memory until the garbage collector does its next sweep and finds objects which no longer have references
(48) Define Predicate.
Ans : A predicate is a logical operator that returns a Boolean value (true or false). There are two types of predicate; comparison predicates, and compound predicates:
A comparison predicate compares two expressions using an operator. The expressions are referred to as the left hand side and the right hand side of the predicate (with the operator in the middle). A comparison predicate returns the result of invoking the operator with the results of evaluating the expressions.
A compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.
(49) Define KVC & KVO.
Ans : Key-value coding (KVC) is a way of decoupling a generic action from the specific properties it may need to act upon. It is most commonly associated with the NSKeyValueCoding protocol but there are a number of other ways to achieve the same effect.
Key-Value-Observing (KVO) is a mechanism by which you can observe changes to keys and their values bound to an object. It lets you make arbitrary objects aware of changes made to values in other objects that are important to you.
(50) What is the difference between KVO and NSNotification Center?
Ans : Key-Value Observing is the process by which one object is alert to changes to another object's property.
NSNotifications are events broadcasted to the NSNotificationCenter, which delivers these events to any objects listening for that specific notification.
The difference is specificity : (1) KVO is usually used to track specific changes to an object (i.e. a `text` property) while NSNotifications are used to track generic "events" (like a user finishing the signup flow). (2) KVO will automatically give you useful information, such as the previous value of a property and the type of change that occurred; NSNotifications only emit whatever extra metadata you explicitly specify. (3) If you have many objects observing a loosely-defined event, like a user signing up or creating a new post, use NSNotificationCenter. If you have only one or a few objects that need to act on the change in another object's specific property, then use KVO.
(51) What is objc_setAssociatedObject() and in what cases should it be used?
Ans : objc_setAssociatedObject adds a key value store to each Objective-C object. It lets you store additional state for the object, not reflected in its instance variables.
It's really convenient when you want to store things belonging to an object outside of the main implementation. One of the main use cases is in categories where you cannot add instance variables. Here you use objc_setAssociatedObject to attach your additional variables to the self object.
When using the right association policy your objects will be released when the main object is deallocated.
Ans : Objective-C is a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language. strictly superset of c.
(2) What is Cocoa & Cocoa Touch?
Ans : Cocoa is for Mac App development and cocoa touch is for apples touch devices - that provide all development environment.
(3) Who invented Objective c?
Ans : Broad cox and Tom Love
(4) Difference between id and void.
Ans : id means "a reference to some random Objective-C object of unknown class" & void means "a reference to some random chunk of memory with untyped/unknown contents".
(5) Difference between nil, Nil & Null.
Ans : nil represent Null-pointer to objective- c object, NIL represent Null-pointer to objective- c class & null represent null pointer to primitive type or absence of data.
(6) Difference between #Define & Static Const.
Ans : #define is a preprocessor macro. The preprocessor will replace every occurrence before the compiler is started. It's not a variable, it's just sort of an automatic find-and-replace mechanism.
static const is a "real" variable that is constant (can't be changed after declaration). Static means that it will be a shared variable across multiple calls to that block.
(7) Difference between Atomic & Nonatomic.
Ans : Atomic means only one thread access the variable(static type). Atomic is thread safe but it is slow in performance.
Nonatomic means multiple thread access the variable(dynamic type). Nonatomic is thread unsafe but it is fast in performance.
(8) Difference between Strong & Retain.
Ans : In a non-ARC project "strong" will act as "retain". In an ARC project "retain" might work if clang doesn't flag an error (i dont use ARC), but theres a subtlety in the description.
Retain says - I'm holding on to this object, until I'm ready to release it & Strong says - ARC treat this as a retained object and insert some generated code in my dealloc method to be released when the autorelease pool drains.
(9) Difference between Assign, Retain & Copy.
Ans : "assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes.
"retain" is needed when the attribute is a pointer to an object. The setter generated by @synthesize will retain (aka add a retain count) the object. You will need to release the object when you are finished with it.
"copy" is needed when the object is mutable. Use this if you need the value of the object as it is at this moment, and you don't want that value to reflect any changes made by other owners of the object. You will need to release the object when you are finished with it because you are retaining the copy.
(10) Difference between Readwrite & Readonly.
Ans : "readwrite" is the default. When you @synthesize, both a getter and a setter will be created for you.
"readonly", no setter will be created. Use it for a value you don't want to ever change after the instantiation of the object.
(11) What is Property?
Ans : An object’s properties let other objects inspect or change its state. But, in a well-designed object-oriented program, it’s not possible to directly access the internal state of an object. Instead, accessor methods (getters and setters) are used as an abstraction for interacting with the object’s underlying data.
(12) What is Protocol?
Ans : A protocol is a group of related properties and methods that can be implemented by any class. They are more flexible than a normal class interface, since they let you reuse a single API declaration in completely unrelated classes.
(13) Difference between @synthesize & @dynamic.
Ans : @synthesize will generate getter and setter methods for your property.
@dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass)
(14) What is Category ?
Ans : A category allows you to add methods to an existing class—even to one for which you do not have the source.
(15) Difference between Deep Copy & Shallow Copy.
Ans : Shallow copies duplicate as little as possible. A shallow copy of a collection is a copy of the collection structure, not the elements. With a shallow copy, two collections now share the individual elements.
Deep copies duplicate everything. A deep copy of a collection is two collections with all of the elements in the original collection duplicated.
(16) Difference between Heap & Stack.
Ans : Stack - The stack is a region of memory which contains storage for local variables, as well as internal temporary values and housekeeping. On a modern system, there is one stack per thread of execution. When a function is called, a stack frame is pushed onto the stack, and function-local data is stored there. When the function returns, its stack frame is destroyed. All of this happens automatically, without the programmer taking any explicit action other than calling a function.
Heap - The heap is, essentially, everything else in memory. Memory can be allocated on the heap at any time, and destroyed at any time. You have to explicitly request for memory to be allocated from the heap, and if you aren't using garbage collection, explicitly free it as well. This is where you store things that need to outlive the current function call. The heap is what you access when you call malloc and free.
(17) Difference between Datasource & Delegate.
Ans : The datasource supplies the data, the delegate supplies the behavior.
(18) Difference between NSNotification & Delegate.
Ans : Notification is used to broadcast messages to possibly several recipients unknown from the sender.
Delegation is used to send messages to a single known recipient acting on behalf of the sender.
(19) Difference between Asynchronous & Synchronous request.
Ans : Asynchronous never block the main thread waiting for a network response.
Synchronous blocks main thread until they complete request.
(20) Difference between Release & Autorelease.
Ans : release - destroy the object from memory
autorelease - destroy the object from memory in future when it is not in use.
(21) Describe View Controller's life cycle.
Ans : Load View > View Did Load > View Will Appear > View Did Appear > View Will Disappear > View Did Disappear > View Did Unload.
(22) Describe Application's life cycle.
Ans : ApplicationDidFinishLaunchingWithOption > ApplicationWillResignActive > ApplicationDidBecomeActive > ApplicationWillTerminate
(23) What is NSThread ?
Ans : An NSThread have an Objective-C method run in its own thread of execution. Threads are especially useful when you need to perform a lengthy task, but don’t want it to block the execution of the rest of the application. In particular, you can use threads to avoid blocking the main thread of the application, which handles user interface and event-related actions. Threads can also be used to divide a large job into several smaller jobs, which can lead to performance increases on multi-core computers.
(24) what is use of NSOperation? how NSOperationque works?
Ans : An operation object is a single-shot object—that is, it executes its task once and cannot be used to execute it again. You typically execute operations by adding them to an operation queueAn NSOperationQueue object is a queue that handles objects of the NSOperation class type. An NSOperation object, simply phrased, represents a single task, including both the data and the code related to the task. The NSOperationQueue handles and manages the execution of all the NSOperation objects (the tasks) that have been added to it.
(25) what is use of NSCoder? how initWithCoder works?
Ans : The NSCoder class is used to archive/unarchive (marshal/unmarshal, serialize/deserialize) of objects. This is a method to write objects on streams (like files, sockets) and being able to retrieve them later or in a different place.
(26) Define Push Notification.
Ans : Push notification, also called server push notification, is the delivery of information from a software application to a computing device without a specific request from the client.
(27) Difference between Mutable & Immutable.
Ans : A mutable object can be mutated or changed. An immutable object cannot. For example, while you can add or remove objects from an NSMutableArray, you cannot do either with an NSArray.
The advantages of your mutable objects is obvious, but they should only be used when necessary (which is a lot less often than you think) as they take up more memory than immutable objects.
(28) How To Submit Your App To the App Store _.
Ans : 1. Create a distribution provisioning profile for your app.
2. Build an archive of your app with that profile.
3. Create an app listing in iTunes Connect and fill in all of the metadata and screenshots.
4.Submit your app for certification through Xcode.
(29) How many types of iOS Developer program are available?
Ans : iOS Developer - For individuals and organizations creating apps for distribution on the App Store. it's cost $99 / year.
iOS Developer Enterprise - For companies and organizations distributing proprietary apps for internal use. it's cost $299 / year.
iOS Developer University - For higher education institutions introducing iOS app development into their curriculum. it's cost Free.
(30) Describe Types of In-App Purchase.
Ans : Consumable - You need to purchase these items every time you want them, and you can't download them again for free. example : Extra health, Extra experience points.
Non-consumable - You purchase these items one time, and you can transfer them to multiple devices authorized with the same iTunes Store account. example : Bonus game levels, City guide maps.
Non-renewing subscriptions - You can purchase these items again after the subscription period ends. example : One-month subscriptions, Location service subscriptions.
Auto-renewable subscriptions - You can purchase these items with different renewal periods. example : Weekly newspaper subscriptions, Weekly magazine subscriptions.
(31) Which compiler used in latest Xcode?
Ans : LLVM ( Low Level Virtual Machine )
(32) Which debugger used in latest Xcode?
Ans : LLDB
(33) Difference between Frame & Bounds.
Ans : The bounds of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).
The frame of an UIView is the rectangle, expressed as a location (x,y) and size (width,height) relative to the superview it is contained within.
(34) Define Screen Size of iOS Device.
Ans : iPhone 4 / 4s : 320px * 480px
iPhone 5 : 320px * 568px
iPad : 768px * 1024px
(35) What is storyboard?
Ans : A storyboard is a visual representation of the user interface of an iOS application, showing screens of content and the connections between those screens.
(36) What is interface & implementation?
Ans : Interface declares the behavior of class and Implementation defines the behavior of class.
(37) Type of data storage in iOS.
Ans : SQLite, CoreData, PropertyList File, JSON / XML File, Array / Dictionary.
(38) Difference between Absolute and Relative path.
Ans : A relative path is going to be a structure based around a root node and an absolute path is going to be a structure based on a non ambiguous location.
(39) Which are basic framework of iOS App Development?
Ans : Foundation.framework, CoreGraphics.framework, UIKit.framework
(40) How to find the memory leaks in MRC?
Ans : Static analyzer, Instrument.
(41) Third party tool for reporting crash log.
Ans : Crashlytics, Crittercism, Bugsense, TestFlight, HockeyApp.
(42) Define MVC.
Ans : MVC stands for Model View Controller, and it is a pattern that allows developers to differentiate code depending on three different roles. It is extremely popular due to its simplicity and it is implemented in different ways in almost every single technology out there -in different ways though. MVC helps you making your code lot more reusable, maintainable and easier to extend.
The three roles are :
(1) Model : The object that holds your application data and defines how to manipulate it.
(2) View : The objects that are in charge of the visual representation of the Model and the controls the user can interact with; basically, all the UIViews and their subclasses.
(3) Controller : The controller is the mediator that coordinates all the work. It accesses the data from the model and displays it with the views, listens to events and manipulates the data as necessary.
(43) Difference between Instance and Class method.
Ans : Class method : It does not need you to allocate instance of that object to use / process it. It is self contained and can operate without any dependence of the state of any object of that class. It is expected to allocate memory for all its own work and deallocate when done, since no instance of that class will be able to free any memory allocated in previous calls to the class method.
Instance method : It is just the opposite. You cannot call it unless you allocate a instance of that class. Its like a normal class that has a constructor and can have a destructor (that cleans up all the allocated memory).
(44) Define GCD.
Ans : Grand Central Dispatch (GCD) dispatch queues are a powerful tool for performing tasks. Dispatch queues let you execute arbitrary blocks of code either asynchronously or synchronously with respect to the caller. You can use dispatch queues to perform nearly all of the tasks that you used to perform on separate threads. The advantage of dispatch queues is that they are simpler to use and much more efficient at executing those tasks than the corresponding threaded code.
(45) Outline the class hierarchy for a UIButton until NSObject
Ans : UIButton inherits from UIControl > UIControl inherits from UIView > UIView inherits from UIResponder > UIResponder inherits from the root class NSObject.
(46) Is this possible to save image in string?
Ans : yes. As a Unicode or base64string.
(47) Difference between ARC and Garbage Collection.
Ans : automatic reference counting, objects are still deallocated as soon as they go out of scope.
garbage collection, objects can remain in memory until the garbage collector does its next sweep and finds objects which no longer have references
(48) Define Predicate.
Ans : A predicate is a logical operator that returns a Boolean value (true or false). There are two types of predicate; comparison predicates, and compound predicates:
A comparison predicate compares two expressions using an operator. The expressions are referred to as the left hand side and the right hand side of the predicate (with the operator in the middle). A comparison predicate returns the result of invoking the operator with the results of evaluating the expressions.
A compound predicate compares the results of evaluating two or more other predicates, or negates another predicate.
(49) Define KVC & KVO.
Ans : Key-value coding (KVC) is a way of decoupling a generic action from the specific properties it may need to act upon. It is most commonly associated with the NSKeyValueCoding protocol but there are a number of other ways to achieve the same effect.
Key-Value-Observing (KVO) is a mechanism by which you can observe changes to keys and their values bound to an object. It lets you make arbitrary objects aware of changes made to values in other objects that are important to you.
(50) What is the difference between KVO and NSNotification Center?
Ans : Key-Value Observing is the process by which one object is alert to changes to another object's property.
NSNotifications are events broadcasted to the NSNotificationCenter, which delivers these events to any objects listening for that specific notification.
The difference is specificity : (1) KVO is usually used to track specific changes to an object (i.e. a `text` property) while NSNotifications are used to track generic "events" (like a user finishing the signup flow). (2) KVO will automatically give you useful information, such as the previous value of a property and the type of change that occurred; NSNotifications only emit whatever extra metadata you explicitly specify. (3) If you have many objects observing a loosely-defined event, like a user signing up or creating a new post, use NSNotificationCenter. If you have only one or a few objects that need to act on the change in another object's specific property, then use KVO.
(51) What is objc_setAssociatedObject() and in what cases should it be used?
Ans : objc_setAssociatedObject adds a key value store to each Objective-C object. It lets you store additional state for the object, not reflected in its instance variables.
It's really convenient when you want to store things belonging to an object outside of the main implementation. One of the main use cases is in categories where you cannot add instance variables. Here you use objc_setAssociatedObject to attach your additional variables to the self object.
When using the right association policy your objects will be released when the main object is deallocated.