- Beginner iOS interview questions:
- What do understand by iOS?
- What are some of the important features of iOS?
- What are the different programming languages used for developing iOS applications?
- What is the JSON framework supported by iOS?
- What is Cocoa and Cocoa Touch?
- How would you define ARC in iOS?
- What is a Bundle ID?
- What are synchronous and asynchronous tasks in iOS?
- What are the different data types in Objective-C?
- What is the importance of using @synchronized in Objective -C?
- Intermediate iOS interview questions:
- How would you describe the UIKit framework in iOS?
- What is iBeacon?
- How can you handle state transitions in iOS applications?
- How would you differentiate between retain and assign?
- What are the different states of an iOS application?
- What are the ways to achieve concurrency in iOS?
- What are the differences between atomic and non-atomic properties?
- What is App ID?
- Can you define NSOperation, NSOperationQueue, and NSBlockOperation?
- What is the use of @dynamic in Objective-C?
- What is NSError?
- Advanced iOS Interview Questions:
- What do you mean by dynamic dispatch?
- What are the ways through which the layout of elements in a UIView can be specified?
- What is a managed object context?
- What do you mean by a 'Responder Chain'?
- What are the rendering options for JSONSerialization?
- Tips to ace iOS interview questions
With mobile phones becoming a crucial part of our lives, the demand for mobile developers is at an all-time high.
iOS has made a mark in the mobile world and has a market of its own, making it one of the most desired operating systems.
If you are aiming to make a career as an iOS or Swift Application Developer, here are a few iOS interview questions for you.
These questions are categorized into beginner, intermediate and advanced categories.
Beginner iOS interview questions:
Here is a list of iOS interview questions for beginners.
What do understand by iOS?
iOS is the operating system that was developed by Apple Incorporated for its devices such as smartphones, tablets, iPods, and iPads.
It was initially called iPhone OS but was later changed to iOS after the launch of the iPad. The initial release date of iOS is 29th June 2007.
A major update to the iOS software is released every year at Apple’s developer conference. The latest version of iOS is iOS 13 that runs on iPhone X that was released on September 19, 2019.
What are some of the important features of iOS?
The most essential features of iOS are:
- Social Media
- Notification Center
- High-end processor
- Powerful APIs
- In-App purchase
- Game Center
What are the different programming languages used for developing iOS applications?
The various programming languages that support iOS application development are mentioned below:
However, the official programming languages for creating iOS applications in are Objective-C and C.
Swift is the programming language developed by Apple. It was developed to run along with Cocoa Touch frameworks and Apple's Cocoa.
What is the JSON framework supported by iOS?
The JSON framework supported by iOS is called SBJSON. The framework provides useful APIs (Application Programming Interfaces) which make handling JSON easy.
The SBJSON framework is an open-source SBJSON parser/generator that is created using Objective-C. The framework helps you write code easily for iOS applications.
What is Cocoa and Cocoa Touch?
Cocoa Touch and Cocoa are environments for developing iOS applications. They both have an Objective C runtime and 2 important frameworks. They are as follows:
Cocoa – This is used for developing applications that run on OSX. It includes frameworks such as AppKit frameworks and Foundation.
Cocoa Touch – This is used for developing applications that can run on the iOS platform. It has frameworks such as UIKit and Foundation.
Objective-C is the primary programming language used for developing applications for Cocoa and Cocoa Touch environments.
Cocoa applications can be developed using languages such as PyObjC and RubyCocoa that are bridged to the Objective-C runtime.
How would you define ARC in iOS?
ARC stands for Automatic Reference Counting. This is a feature that is used for handling the lifetime of the objects in Objective-C.
It is a memory management technique for the Clang compiler that is used by both Swift and Objective-C for reference counting.
In Swift, ARC allocates a block of memory each time a new instance of a class is created.
ARC stores information about the class instances being currently referred to, the variables, constants, and instance properties.
What is a Bundle ID?
The Bundle ID or Bundle Identifier is used for uniquely identifying iOS applications. This is applicable for both iOS and OSX applications.
For selecting an application bundle’s identifier, application developers use reverse domain name notation.
For creating a unique bundle identifier, you need to add the name of the application to the reversed domain like com.cocoacasts.writing.
What are synchronous and asynchronous tasks in iOS?
Synchronous tasks wait for the tasks to get executed. Here, two tasks can run at the same time or in alternative fashion.
In iOS, the performBlockAndWait method is synchronous where the primary thread will stop and wait for a response.
After receiving the response from the block, it will perform the next operation.
Asynchronous tasks run in the background and indicate their completion. The performBlock method can run without knowing whether the block has started execution.
What are the different data types in Objective-C?
Objective-C has the following data types:
What is the importance of using @synchronized in Objective -C?
The @synchronized directive is used in Objective-C for ensuring that only one thread gets executed at any given point of time.
The facility prevents the Race Condition, where more than one thread tries to access the same address in memory.
Intermediate iOS interview questions:
Here is a list of some intermediate iOS interview questions.
How would you describe the UIKit framework in iOS?
The UIKit framework is for creating the user interface for the iOS application. It offers various options such as controls, views, windows, model drawing, and event handling.
It also provides an application model for interacting with the system. It supports the following features:
- Motion and touch-based events
- Print support
- Supports external displays along with windowing and graphics support
- PDF creation
- Content can be shared through email, Facebook and Twitter
What is iBeacon?
iBeacon is a protocol developed by Apple Inc. This protocol implements the Bluetooth low energy technology to send location information to iPhones and other Apple devices.
It listens to signals from beacons, which are small Bluetooth transmitters. iOS applications respond to these beacons when they are nearby.
For example, you are at a mall and there are beacons nearby. Through your iBeacon application, you will receive the latest offers and discounts in the shops or outlets.
How can you handle state transitions in iOS applications?
The iOS applications goes through different states. The different states in iOS include non-running, inactive, active, background and suspended.
The different methods used for handling state transitions are:
applicationDidBecomeActive( ) – This method is called to notify the application that it has moved from the active to an inactive state. It can be used for restarting paused tasks that were paused during the application’s inactive state.
applicationWillEnterForeground( ) – This method is invoked for running a piece of code when the application is moving out of the background.
applicationDidEnterBackground( ) – This method is called when you want to execute some code when the application is executing in the background but can get suspended.
applicationWillTerminate( ) – This method notifies the application that it is about to be terminated and removed from the memory. It can be for clean-up tasks such as freeing resources and saving data.
How would you differentiate between retain and assign?
In iOS, assign is a keyword that is used for making a reference from one object to another.
The retain count of the source is not increased. This is an example code:
if (obj1 !=
obj1 = nil;
obj1 = obj2;
Retain is a keyword that is used for creating a reference from an object to another.
Here, the retain count of the source object is increased. This is an example:
if (obj1 !=
obj1 = nil;
obj1 = [obj2 retain];
What are the different states of an iOS application?
The different states that an iOS application goes through are as follows:
Not-running – This state defines the time when the application has not yet been initiated.
Inactive – In this state, the application continues executing in the foreground. It stays in this state before transitioning into another state.
Active – This state defines that the application is running in the foreground but is receiving events.
Background – The application is in this state when it is running in the background and executing some code. Before being suspended, applications enter this state.
Suspended – If an application does not execute any code but resides in the memory, it is in a suspended state. For making room in the memory, the system may remove the suspended application from the memory.
What are the ways to achieve concurrency in iOS?
Concurrency is the process in iOS where two or more programs can execute together.
As all iOS devices have multicore processors, concurrency allows multi-tasking. The most common ways of achieving concurrency are as follows:
- Dispatch queues
- Operation queues
What are the differences between atomic and non-atomic properties?
When you define a property as atomic, it is guaranteed that a valid value will be returned. This is the default state for properties that are synthesized.
But, not all returned atomic values are correct. They are not thread-safe. More than one thread may attempt to perform a read and write operation at the same time.
Non-atomic properties do not guarantee that a valid value will be returned. This value can be a garbage value, a correct value or a partially written value.
What is App ID?
An App ID is a unique identifier that is used for connecting an application to the Apple Push Notification service.
One or more applications are represented in the iOS system using this ID. An App ID has two components – a Bundle ID search string and a Team ID.
Here, ABCDE12345 is the Team ID and com.cocoacasts.writing is the bundle ID. This bundle ID of a particular App ID can match an application.
Using a wildcard, it can match several applications of the development team.
Can you define NSOperation, NSOperationQueue, and NSBlockOperation?
NSOperation is an abstract class in iOS that can be used through the NSOperation subclasses.
It can be used for adding dependencies to different operations, cancel, reuse and suspend them.
NSOperationQueue is a queue that monitors the operations. It executes the queued operation objects based on their priority. They are not a part of GCD.
NSBlockOperation is a subclass of NSOperation that manages the execution of one or more tasks concurrently.
What is the use of @dynamic in Objective-C?
The @dynamic keyword notifies the compiler that the setter and getter methods are not implemented by the class but elsewhere. It is used for the subclasses of NSManegedObject.
What is NSError?
The NSError is a class for handling exceptions. NSError objects convey the error information to users during runtime, usually in a dialogue box.
It has three main components:
- Domain – The error domain can be a pre-defined NSError domain or a string describing the domain.
- Code – The code for the error.
- UserInfo – This is the error’s userInfo dictionary that can be nil.
Advanced iOS Interview Questions:
Here is a list of some advanced level iOS interview questions.
What do you mean by dynamic dispatch?
In dynamic dispatch, the implementation of a polymorphic operation is chosen during the runtime, instead of the compile time.
The two types of dynamic dispatch are – table dispatch and message dispatch. In table dispatch, a witness table is looked up for finding the implementation for a particular method.
In message dispatch, method swizzling is enabled. This can be used for changing the functionality of a method during its runtime.
What are the ways through which the layout of elements in a UIView can be specified?
The different ways to specify element layout in a UIView are as follows:
You can use your code along with NSLayoutConstraints to arrange the elements using AutoLayout.
A storyboard for the application can be built using the InterfaceBuilder. Using this, you can include a XIB file into your project, arrange the layout within it and load the file in your application code.
You can mention the coordinates of each element using CGRects. You can then pass the (id)initWithFrame:(CGRect)frame method of UIView.
What is a managed object context?
Managed object context can be considered as a scratchpad. You can fetch objects from a persistent store and bring temporary copies of those objects to this pad.
After making the necessary changes, you can put them back to the store. The context has an undo manager that monitors all these changes.
The context also posts notifications that can be monitored within your application.
What do you mean by a 'Responder Chain'?
A sequence or chain of responder objects is called Responder Chain. The chain starts with the initial responder and ends at the application object.
These objects can respond to the objects they receive. When the first responder cannot handle an event, it is passed onto the next responder.
What are the rendering options for JSONSerialization?
The different rendering options for JSONSerialization are as follows:
MutableContainers – This is a process where dictionaries and arrays are created as variable objects.
allowFragments– In this process, the parser allows objects that are not instances of dictionaries or arrays.
MutableLeaves – Here, JSON object graph leaf strings are developed as instances of variable strings.
Tips to ace iOS interview questions
Here are some tips to face iOS interview questions like a pro.
Know about the company
Research well about the company and find out the relevant aspects that will help you learn more.
Try getting insights into the company from their employees. You can visit Ambitionbox.com to read reviews and feedbacks.
Brush up the basics
Before going for the interview, brush up all the important terms relevant to your profile.
Read about technological advancements and potential questions that can be asked in the interview.
Reach on time
You must reach on time for the interview. Punctuality shows discipline and a strong work ethic. Try reaching a little early to feel more comfortable with the environment.
Keep all documents in place
Interviewers may ask for documents concerning your candidature. Try to keep them organized in a folder. This way, when you are asked for a document, you can easily find it without appearing clumsy.
Opt for formal attire to ace your iOS interview. This will not only impress your interviewer but will make you feel more confident too.
Also read: Interview dress code