Thursday 24 September 2015

Job Interview iPhone Interview Questions and Answers

71. What is @synthesize?
We use @synthesize to generate getters and setters automatically from compiler. We declare properties and then generate getter and setter method by using @synthesize.

72. What is nonatomic?
nonatomic and atomic are related to multithreading environment . If a property has an attribute as “nonatomic” that means multiple threads can modify that property concurrently. If the attribute is “atomic”, the threads would be given access atomically. So “Atomic” is thread safe while “nonatomic” is thread unsafe. Atomic drastically hampers the performance so until and unless not needed you should never go for atomic attribute. ‘nonatomic ’ will do in most of the cases.

73. What are the delegate methods of MKMapView?
Firstly you have added the storeKit framework in your xcode project then define the protocol as <MKMapviewDelegate> in .h file.
- (void)mapView:(MKMapView *)mapView regionWillChangeAnimated:(BOOL)animated;
- (void)mapView:(MKMapView *)mapView regionDidChangeAnimated:(BOOL)animated;
- (void)mapViewWillStartLoadingMap:(MKMapView *)mapView;
- (void)mapViewDidFinishLoadingMap:(MKMapView *)mapView;
- (void)mapViewDidFailLoadingMap:(MKMapView *)mapView withError:(NSError *)error;
- (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>)annotation;
- (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views;

74. What are the important delegate methods of NSXML parser?
-DidStartElement
-FoundCharecters
-DidEndElement
-FoundError

75. What is @dynamic and any place where it is used?
It tells compiler that getter and setter are not implemented by the class but by some other class.
May be super class or child class.
Example – Core Data.
- The Managed object classes have properties defined by using @dynamic.





76. Types of parsers?
There are various parsers available to parse an XML in iOS app development. You can choose either from iOS SDK provided by Apple or from third party libraries. Before discussing about various options, I want to highlight difference between XML parsers. Generally two types of parsers are used in XML parsing: SAX and DOM. Let's have a look at their brief description.
SAX parser- This parser is based on some notifying methods. These methods are notified as the SAX parser moves on the XML document. During the parsing activity, developer is responsible to construct required object and keep track of state of the XML parser. Some examples of this parser are as follows-
NSXMLParser - It is written in Objective-C and provided by Apple through its iOS SDK.
libxml2 - It is based on C language API and also provided by Apple through its iOS SDK. It supports both SAX and DOM parser.
DOM parser- This parser parse the complete document in a single go and converts it into a specific structured object. We can create XPath query for a particular element from this structured object. Some examples of this parser are as follows-
TBXML- It's a lightweight XML parser designed in such a way to consume very low memory. It's a good choice for an XML as well as that have the fixed structure.
TouchXML - It is another DOM parser. It is also read only but does not support XPath queries.
KissXML - It is based on TouchXML parser. It supports editing and writing XML unlike TouchXML parser.
TinyXML - It is very small DOM parser and based on C language API. It supports editing and writing XML documents like KissXML parser but does not support XPath queries.
GDataXML - It is developed by Google using Objective-C API. It supports both editing of XML documents and XPath queries.

More Questions & Answers:-
Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8

No comments:

Post a Comment