Latest Questions
Post Top Ad
Your Ad Spot
Friday, June 21, 2019

75 Top iOS Interview Questions and Answers {Updated}

iOS Interview Questions and Answers for experienced PDF, Read commonly asked iOS Job Interview Questions with Answers PDF for Freshers.

Read iOS Interview Questions and Answers

Assume that an app is not in the foreground but is still executing code. In which state will it be in?
Background state.
An app is loaded into memory but is not executing any code. In which state will it be in?
An app is said to be in a suspended state when it is still in memory but is not executing any code.

Which JSON framework is supported by iOS?
SBJson framework is supported by iOS.  It is a JSON parser and generator for Objective-C. SBJson provides flexible APIs and additional control that makes JSON handling easier.

How can you respond to state transitions on your app?
On state, transitions can be responded to state changes in an appropriate way by calling corresponding methods on the app’s delegate object.
For example:
the applicationDidBecomeActive method can be used to prepare to run as the foreground app.
the applicationDidEnterBackground method can be used to execute some code when the app is running in the background and may be suspended at any time.
the applicationWillEnterForeground method can be used to execute some code when your app is moving out of the background
the applicationWillTerminate method is called when your app is being terminated.
List down app’s state transitions when it gets launched.
Before the launch of an app, it is said to be in not running state.
When an app is launched, it moves to the active or background state, after transitioning briefly through the inactive state.

What are the important delegate methods of NSXML parser?

What is Automatic Reference Counting (ARC) ?
ARC is a compiler-level feature that simplifies the process of managing the lifetimes of Objective  C objects. Instead of you having to remember when to retain or release an object, ARC evaluates the lifetime requirements of your objects and automatically inserts the appropriate method calls at compile time.

What is the purpose of the UIWindow object?
The presentation of one or more views on a screen is coordinated by the UIWindow object.

Apart from incorporating views and controls, what else an app can incorporate?
Apart from incorporating views and controls, an app can also incorporate Core Animation layers into its view and control hierarchies.

Assume that the system is running low on memory. What can the system do for suspended apps?
In case the system is running low on memory, the system may purge suspended apps without notice.

Which object is create by UIApplicationMain function at app launch time?
The app delegate object is created by UIApplicationMain function at app launch time. The app delegate object’s main job is to handle state transitions within the app.

How do you change the content of your app in order to change the views displayed in the corresponding window?
To change the content of your app, you use a view controller to change the views displayed in the corresponding window. Remember, the window itself is never replaced.

Define the view object.
Views along with controls are used to provide a visual representation of the app content. A view is an object that draws content in a designated rectangular area and it responds to events within that area.

What are the location services?
Applications such as Maps, camera, and compass are allowed to use the information from cellular, Wi-Fi and Global Positioning System networks for determining the approximate locations.
The location is displayed on the screen, using a blue marker.

What is a delegate?
A delegate is an object that handles the events happening on an object. To do that delegate has to follow a protocol specifying the task it is going to handle.

What is the use of controller object UIApplication?
Controller object UIApplication is used without subclassing to manage the application event loop. It coordinates other high-level app behaviors.
It works along with the app delegate object which contains app-level logic.

Assume that your app is running in the foreground but is currently not receiving events. In which state it would be in?
An app will be in InActive state if it is running in the foreground but is currently not receiving events. An app stays in InActive state only briefly as it transitions to a different state.

Which object manages the presentation of the app’s content on the screen?
View controller objects take care of the presentation of the app’s content on the screen. A view controller is used to manage a single view along with the collection of subviews. It makes its views visible by installing them in the app’s window.

How is the app delegate is declared by Xcode project templates?
App delegate is declared as a subclass of UIResponder by Xcode project templates.

What are the popular apps of iPhone?
Face book-Social networking
Doodle Buddy-drawing
Pandora Radio-radio on our iPhone
Yelp-restaurant reviews

What is the difference between NSNotification and delegate?
Delegate is passing the message from one object to other objects. It is like one to one communication while a notification is like passing the message to multiple objects at the same time. All other objects that have subscribed to that notification or acting observers to that notification can or can’t respond to that event. Notifications are easier but you can get into trouble by using those like bad architecture. Delegates are more frequently used and are used with the help of protocols.

What’s the difference between frame and bounds?
The frame of a view is the rectangle, expressed as a location (x,y) and size (width, height) relative to the superview it is contained within. The bounds of a view are the rectangle, expressed as a location (x,y) and size (width, height) relative to its own coordinate system (0,0).

Describe the functionality of accelerometer of an iPhone?
iPhone responds to motion using a built-in accelerometer.
The accelerometer detects the movement and changes the display accordingly, at the time of rotating iPhone from portrait to landscape.

Who calls the main function of your app during the app launch cycle?
During app launching, the system creates a main thread for the app and calls the app’s main function on that main thread. The Xcode project’s default main function hands over control to the UIKit framework, which takes care of initializing the app before it is run.

How many bytes we can send to apple push notification server.

What are the requirements for developing iPhone Apps?
Mac OS 10.5/10.6 iPhone SDK (Software Development Kit 3.0/4.0).
iPhone SDK consists of:
IDE to develop iPhone Apps is XCode(This tool is inbuilt in iPhone SDK)
Interface Builder This is used to designing GUI of Apps(Inbuilt feature of iPhone SDK)
Instruments  This is used to check any memory leaks in our apps (Inbuilt in SDK)
Simulator This is used to test our apps before deploying into a real device.

What is iPhone architecture?
It is similar to Mac OS X architecture
It acts as an intermediary between the iPhone and iPod hardware and the appearing applications on the screen
The user created applications never interact directly with the appropriate drivers, which protects the user applications from changes to the hardware.

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.)

Difference between categories and extensions?
Class extensions are similar to categories. The main difference is that with an extension, the compiler will expect you to implement the methods within your main @implementation, whereas with a category you have a separate @implementation block. So you should pretty much only use an extension at the top of your main .m file (the only place you should care about ivars, incidentally) — it’s meant to be just that, an extension.

Why an app on an iOS device behaves differently when running in foreground than in background?
An application behaves differently when running in foreground than in background because of the limitation of resources on iOS devices.

Introduction to iphone application Development?
In 2007, Apple entered the cellular phone business with the introduction of the iPhone, a multi-touch display cell phone, which also includes the features of the iPod.

What are the tools required to develop iOS applications?
iOS development requires Intel-based Macintosh computer and iOS SDK.

Name the framework that is used to construct an application’s user interface for iOS.
The UIKit framework is used to develop the application’s user interface for iOS. The UIKit framework provides event handling, drawing model, windows, views, and controls specifically designed for a touch screen interface.

What is the iPhone OS?
iPhone OS runs on iPhone and iPod touch devices.
Hardware devices are managed by iPhone OS and provide the technologies needed for implementing native applications on the phone.
The OS ships with several system applications such as Mail, Safari, Phone, which provide standard services to the user.

When an app is said to be an inactive state?
An app is said to be an inactive state when it is running in the foreground and is receiving events.
Name the app sate which it reaches briefly on its way to being suspended.
An app enters background state briefly on its way to being suspended.

Difference between COCOA, COCOA touch and objective C?
Objective C is a dynamic programming language – a bit like C++ and a bit like Java.
Cocoa is the application framework for Mac OS X. Cocoa Touch is the application framework for iPhone and iPod Touch – very similar to Cocoa.
Cocoa is commonly referred to as the combination of the Foundation and AppKit frameworks, while Cocoa Touch is the combination of the Foundation and UIKit frameworks. Cocoa and Cocoa Touch sit on top of other collections of frameworks to create the API stacks. The other layers are Media, Core Services and Core OS. The main difference between Cocoa and Cocoa touch is that the UI classes and APIs aren’t the same as Mac OS X, so instead of NSTextField, you have UITextField. Many of the classes share the same functionality and can be ported quite easily by simply changing the class name, though most will require some more changes, but usually nothing too heavy. There are also some differences between the Foundation frameworks in Cocoa and Cocoa Touch, most commonly missing classes, eg, Cocoa has NSHost and Cocoa Touch doesn’t.

Why iPhone apps are popular?
Give our business a whole new way of transacting business for millions of users.
iPhones are the market leaders in the smartphone segment. The iPhone has become a great device to surf the internet, play games, interact with social networks and transact business.

Multitasking support is available from which version?
iOS 4.0

What are the ways to store data locally on the iPhone device?
We store data locally in the device through:
1. Plist.
2. NSUserDefaults.
3. SQLite.
4. CoreData.

What is the iPhone reference library?
iPhone reference library is a set of reference documents for iPhone OS. It can be downloaded by subscribing to the iPhone OS Library doc set. Select Help>Documentation from X code, and click the subscribe button next to the iPhone OS Library doc set, which appears in the left column.

When an app is said to be in not running the state?
An app is said to be in ‘not running’ state when:
it is not launched.
it gets terminated by the system during running.

Difference between shallow copy and deep copy?
Shallow copy is also known as address copy. In this process, you only copy address not actual data while in the deep copy you copy data.
Suppose there are two objects A and B. A is pointing to a different array while B is pointing to a different array. Now what I will do is following to do shallow copy.?Char *A = {‘a’,’b’,’c’};?Char *B = {‘x’,’y’,’z’};?B = A;?Now B is pointing is at the same location where A pointer is pointing. Both A and B in this case sharing the same data. if the change is made both will get altered value of data. The advantage is that the coping process is very fast and is independent of the size of the array.
while in deep copy data is also copied. This process is slow but Both A and B have their own copies and changes made to any copy, others copy will not be affected.

You wish to define your custom view. Which class will be subclassed?
Custom views can be defined by subclassing UIView.

Name the application thread from where UIKit classes should be used?
UIKit classes should be used only from an application’s main thread.  Note: The derived classes of UIResponder and the classes which manipulate the application’s user interface should be used from the application’s main thread.

What happens if the application object does not handle an event?
In such a case, the event will be dispatched to your app delegate for processing.

What is the iPhone reference library?
iPhone reference library is a set of reference documents for iPhone OS.
It can be downloaded by subscribing to the iPhone OS Library doc set.
Select Help>Documentation from X code, and click the subscribe button next to the iPhone OS Library doc set, which appears in the left column.

When to use NSMutableArray and when to use NSArray?
Normally we use the mutable version of the array where data in the array will change. For example, you are passing an array to function and that function will add some elements to that array or will remove some elements from the array, then you will select NSMutableArray. When you don’t want to change your data, then you store it into NSArray. For example, the country names you will put into NSArray so that no one can accidentally modify it.

Does iOS support multitasking?
iOS 4 and above supports multi-tasking and allows apps to remain in the background until they are launched again or until they are terminated.

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 various options, I want to highlight the 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, the developer is responsible to construct the required object and keep track of the 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 parses 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 has 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 the Objective-C API. It supports both editings of XML documents and XPath queries.

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

What is the iPhone SDK?
iPhone SDK is available with tools and interfaces needed for developing, installing and running custom native applications. Native applications are built using the iPhone OS’s system frameworks and Objective-C language and run directly on iPhone OS. Native applications are installed physically on a device and can run in the presence or absence of network connection.

Where can you test Apple iPhone apps if you don’t have the device?
iOS Simulator can be used to test mobile applications. Xcode tool that comes along with iOS SDK includes Xcode IDE as well as the iOS Simulator. Xcode also includes all the required tools and frameworks for building iOS apps.  However, it is strongly recommended to test the app on the real device before publishing it.

Explain about the applications that can be used with the iPhone?
Technology, Entertainment, and Design (TED): Allows to watch and listen to the world’s most fascinating people have to say, all on the iPhone.

What are KVO and KVC?
KVC: Normally instance variables are accessed through properties or accessors but KVC gives another way to access variables in the form of strings. In this way, your class acts like a dictionary and your property name for example “age” becomes key and value that property holds becomes a value for that key. For example, you have an employee class with the name property.
You access a property like
NSString age = emp.age;
setting a property value.
emp.age = @”20?;
Now how KVC works is like this
[emp valueForKey:@”age”];
[emp setValue:@”25? forKey:@”age”];
KVO: The mechanism through which objects are notified when there is a change in any of property is called KVO.
For example, person object is interested in getting a notification when the accountBalance property is changed in the BankAccount object. To achieve this, Person Object must register as an observer of the BankAccount’s accountBalance property by sending an
addObserver:forKeyPath:options:context: message.

What is @implementation?
It’s a keyword used to define the Class.

What is the iPhone?
iPhone is a combination of internet and multimedia enabled smartphone developed by Apple Inc.iPhone functions as a camera phone, including text messaging, and visual voice mail. iPhone is a portable media player that resembles a video iPod It has a user interface that is built around the multi-touch screen including a virtual keyboard.

Which API is used to write test scripts that help in exercising the application’s user interface elements?
UI Automation API is used to automate test procedures. Tests scripts are written in JavaScript to the UI Automation API.  This, in turn, simulates user interaction with the application and returns log information to the host computer.

The flow of push notification?
Your web server sends a message (device token + payload) to Apple push notification service (APNS), then APNS routes this message to a device whose device token specified in the notification.

What are layer objects and what do they represent?
Layer objects are data objects which represent visual content. Layer objects are used by views to render their content. Custom layer objects can also be added to the interface to implement complex animations and other types of sophisticated visual effects.

What is @interface?
It’s a keyword used to declare the Class.

What is MVC? MVC Architecture of iPhone App.
Here are the reasons why we should use the MVC (Model View Controller)design pattern.
1. MVC is reusable: When the problems occur, there is no need to invent a new solution, we just have to follow the pattern and adapt it as necessary.
2. MVC is expressive: By using the MVC design pattern our application becomes more expressive.
1).  Model: The model object knows about all the data that need to be displayed. It is a model who is aware of all the operations that can be applied to transform that object. It only represents the data of an application. The model represents enterprise data and the business rules that govern access to and updates of this data. Model is not aware of the presentation data and how that data will be displayed to the browser.
2). View: The view represents the presentation of the application. The view object refers to the model. It uses the query methods of the model to obtain the contents and renders it. The view is not dependent on the application logic. It remains the same if there is any modification in the business logic. In other words, we can say that it is the responsibility of the view’s to maintain consistency in its presentation when the model changes.
3). Controller:  Whenever the user sends a request for something then it always goes through the controller. The controller is responsible for intercepting the requests from view and passes it to the model for the appropriate action. After the action has been taken on the data, the controller is responsible for directing the appropriate view to the user. In  GUIs, the views and the controllers often work very closely together.

Which app specific objects store the app’s content?
Data model objects are app specific objects and store app’s content. Apps can also use document objects to manage some or all of their data model objects.

The garbage collector in iPhone?
iOS has got the ARC ( Automated reference counting ). Objective C does not have a garbage collector rather it uses the reference counting algorithm to manage the memory. This was the developer's task until Apple launched iOS 5.0. Again if you are targeting iOS 4.0 or earlier, ARC is no more a choice for you.

What are sensors in the iPhone?
The proximity sensor immediately turns off the display when the iPhone is lifted to ear. With this sensor, the power is saved and accidental dialing is prevented.
The display is automatically brightened the iPhone by the ambient light sensor when the sunlight or bright rooms and dims in darker places.

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

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” threads safe while “nonatomic” is thread unsafe. Atomic drastically hampers the performance so until and unless not needed you should never go for the atomic attribute. ‘nonatomic ’ will do in most of the cases.

Which framework delivers the event to a custom object when the app is in the foreground?
The UIKit infrastructure takes care of delivering events to custom objects. As an app developer, you have to override methods in the appropriate objects to process those events.

Give example scenarios when an application goes into InActive state?
An app can get into InActive state when the user locks the screen or the system prompts the user to respond to some event e.g. SMS message, incoming call, etc.

What are the delegate methods of MKMapView?
Firstly you have added the storeKit framework in your xcode project then define the protocol as 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 )annotation;
– (void)mapView:(MKMapView *)mapView didAddAnnotationViews:(NSArray *)views;

What is the advantage of categories? What is the difference between implementing a category and inheritance?
You can add a method to an existing class even to that class whose source is not available to you. You can extend the functionality of a class without subclassing. You can split implementation in multiple classes. While in Inheritance you subclass from a parent class and extend its functionality.

What is polymorphism?
This is a very famous question and every interviewer asks this. Few people say polymorphism means multiple forms and they start giving an example of draw function which is right to some extent but the interviewer is looking for a more detailed answer.
The ability of base class pointer to call the function from derived class at runtime is called polymorphism.

Are document objects required for an application? What do they offer?
Document objects are not required but are very useful in grouping data that belongs in a single file or file package.

Which is the superclass of all view controller objects?
UIViewController class. The functionality for loading views, presenting them, rotating them in response to device rotations, and several other standard system behaviors are provided by UIViewController class.

How can an operating system improve battery life while running an app?
An app is notified whenever the operating system moves the apps between foreground and background.  The operating system improves battery life while it bounds what your app can do in the background. This also improves the user experience with the foreground app.

What are the features of iPhone 3gs?
Video: Videos can be edited, shared. High-quality VGA video can be shot in portrait or landscape.
3 Megapixel Camera: Still photos with greater quality can be taken
Voice control: It recognizes the names in contacts and recognizes the music on iPod.
Compass: iPhone 3GS has a built-in digital compass, used to point the way.
Internet Tethering: Internet surfing can be done from anywhere. A 3G connection can be shared on Iphone3 with Mac notebook or laptop.

What is an iPhone app?
An iPhone app is a program that runs on our iPhone/iPod Touch. It enables us to accomplish a certain task. They could be utility apps, games, enterprise apps, entertainment apps, apps to access our bank account, etc.

What is the push notification?
Imagine, you are looking for a job. You go to software company daily and ask sir “is there any job for me” and they keep on saying no.  Your time and money is wasted on each trip. (Pull Request mechanism).
So, one day owner says, if there is any suitable job for you, I will let you know. In this mechanism, your time and money are not wasted. (Push Mechanism).

Post Top Ad

Your Ad Spot