IOS



21. Whats fast enumeration?  

Fast enumeration is a language feature that allows you to enumerate over the contents of a collection. (Your code will also run faster because the internal implementation reduces message send overhead and increases pipelining potential.)



22. What is plist?  

In iPhone development, Property Lists are a key-value store that your application can use to save and retrieve persistent data.
Plist means PropertyList It is XML file format It is mainly user for store and retrieve data It can store as key-value pair.



23. What is the difference between #import and @class?  

As already discussed #import is a preprocessor that requires the compiler to include the header file. But what if, the class itself is not available to be included or there is a circular reference between class A and class B?

Thats when the construct @class is useful.

@class is a "forward declaration" and whenever the compiler encounters an @class forward declaration, the compiler just notes that the actual declaration of the class is coming forward and hence doesn't worry about anything about that class, other than to reserve the memory allocation for a pointer whenever an instance of such forward declared classes are referred to.

For example, in the code
@class A
@interface B :NSObject {
A * obj;
}

Here, since class A is a forward declaration, the compiler just reserves the memory for a pointer and ignores further validation.

Forward declaration not only reduces the pre-processing overheads and makes compilation & linking faster, but also helps better development as the implementation of class A can be "deferred" without impacting the development of class B.



24. What is the difference between #import "abc" and #import <abc>?  

#import "abcd/abcd.h" form is "find my very own header, if you can't find it in local, look for a system header".

The <abcd/abcd.h> form is "find a system header".They could be implemented differently on a given platform.




25. What is the difference between #include<abc> and #include "abc"?  

#include <abc> tells the compiler to look in all include directories.
#include "abc" tells the compiler to look only in the directory of the file with the include in it.




26. What is method swizzling in Objective C and why would you use it?  

Method swizzling allows the implementation of an existing selector to be switched at runtime for a different implementation in a classes dispatch table. Swizzling allows you to write code that can be executed before and/or after the original method.



27. What is meaning of "copy" keyword?  

copy object during assignment and increases retain count by 1.



28. What is meaning of "readOnly" keyword?  

Declare read only object / declare only getter method.



29. What is meaning of "retain" keyword?  

Specifies that retain should be invoked on the object upon assignment. takes ownership of an object.



30. What is meaning of "assign" keyword?  

Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float,int.



31. What is meaning of "atomic" keyword?  

"atomic", the synthesized setter/getter will ensure that a whole value is always returned from the getter or set by the setter, only single thread can access variable to get or set value at a time.



32. What is meaning of "nonatomic" keyword?  

In non atomic no such guaranty that value is returned from variable is same that setter sets. at same time.



33. What is difference between "assign" and "retain" keyword?  

Retain - Specifies that retain should be invoked on the object upon assignment. takes ownership of an object.
Assign - Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float,int.




34. What is meaning of "synthesize" keyword ?  

ask the compiler to generate the setter and getter methods according to the specification in the declaration.



35. Whats a struct?  

A struct is a special C data type that encapsulates other pieces of data into a single cohesive unit. Like an object, but built into C.



36. Whats the difference between NSArray and NSMutableArray?  

NSArray's contents can not be modified once it's been created whereas a NSMutableArray can be modified as needed, i.e items can be added/removed from it.



37. What is IPA?  

IPA stands for "iOS App Store Package"
An .ipa file is an iPhone application archive file which stores an iPhone app. It is usually encrypted with Apple's FairPlay DRM technology. Each .ipa file is compressed with a binary for the ARM architecture and can only be installed on an iPhone, iPod Touch, or iPad.



38. What's the difference between not-running, inactive, active, background and suspended execution states?  

Not running: The app has not been launched or was running but was terminated by the system.

Inactive: The app is running in the foreground but is currently not receiving events. (It may be executing other code though.) An app usually stays in this state only briefly as it transitions to a different state.

Active: The app is running in the foreground and is receiving events. This is the normal mode for foreground apps.

Background: The app is in the background and executing code. Most apps enter this state briefly on their way to being suspended. However, an app that requests extra execution time may remain in this state for a period of time. In addition, an app being launched directly into the background enters this state instead of the inactive state.

Suspended: The app is in the background but is not executing code. The system moves apps to this state automatically and does not notify them before doing so. While suspended, an app remains in memory but does not execute any code. When a low-memory condition occurs, the system may purge suspended apps without notice to make more space for the foreground app.




39. What is "Protocol" on objective c?  

A protocol declares methods that can be implemented by any class. Protocols are not classes themselves. They simply define an interface that other objects are responsible for implementing. Protocols have many advantages. The idea is to provide a way for classes to share the same method and property declarations without inheriting them from a common ancestor.



40. What is "private", "Protected" and "Public"?  

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.



.Net Interview Question

PHP Interview Question

Java Interview Question

AngularJS Interview Questions