IOS Interview Questions and Answers
Q1: Which JSON framework that is supported by IOS?
Ans. The JSON framework that is supported by IOS is SBJSON.
- SBJSON is a generator for Objective-C
- It provides a flexible API and additional control, making JSON handling much easier.
Q2: What are the ways to attain concurrency in IOS?
Ans. There are three ways to attain concurrency in IOS. They are as follows:
- Dispatch queues
- Operation queues
Q3: Explain the different types of IOS application states?
Ans. The different IOS application states are as follows:
- Not running state: When the app was running but it is terminated by the system or the app has not been launched
- Active state: When the app is running in the foreground and receiving the events. This is the normal mode for the foreground app
- Inactive state: When the app is running in the foreground but not receiving the events. The only time it stays inactive when the user locks the screen or the system prompts the user to respond to the events such as phone calls or messages.
- Suspended state: A suspended app just persists in memory but does not execute any code. When a low memory condition happens, the system may exclude the suspended app without any notice to the users to provide the space for foreground apps.
- Background state: When the application is running in the background and executes code will be in this state. Before being suspended, the application enters this state. Yet, an app that appeals for additional time for execution must prevail in the Background state. Also when an app is being launched directly into the background will enter this state.
Q4: What is the difference between atomic and non-atomic properties?
Ans. An atomic property will always return the initialized objects and also happens to be a default state for a synthesized property. Yet, not all the values are correct. They are not safe. More than one thread may strive to perform read-write operations simultaneously.
The non-atomic property does not ensure a valid value to be returned. This value can be a correct value, a trash value, or a partially written value.
Q5: What is Cocoa and Cocoa touch?
Ans. Cocoa: It provides an Application development environment for OS X. It includes the Foundation and Appkit framework.
Cocoa Touch: It provides an Application development environment for iOS. It includes the Foundation and UIkit framework. It refers to application development using any programmatic interface.
The primary programming language that is used for developing the application in cocoa and cocoa touch is the Objective-C.
Q6: Define managed object context?
Ans. A managed object content is basically a scratchpad in an application for a related collection of objects. You can get objects from a persistent store to bring temporary objects to this pad. After making the required modification, you can put them back to the store. The context has an undo manager that monitors all these changes and also posts a notification to your application.
Q7: Mention the key functionalities of Managed object context?
Ans. The key functionalities of the managed object context include as follows:
- Lifecycle management: The context is responsible for expecting changes in its objects and keeps an undo manager so you can have better control over an undo and redo. You can insert new objects and delete ones you got fetched, and submit these changes to the persistent store.
- Concurrency: Here, the core data uses threads that restrict to ensure managed object contexts. when you create a context you can specify the concurrency pattern with that you can use it by using initWithConcurrencyType:
- Notification: A context posts notifications at different points that can alternatively be observed elsewhere in your application.
Q8: What are the rendering options for JSON Serialization?
Ans. The rendering options for JSON Serialization are as follows:
- MutableContainers: Dictionaries and arrays are created as variable objects.
- MutableLeaves: JSON object graph leaf strings are developed as instances of variable strings
- allowFragment: The parser allows objects that are not an instance of dictionaries or arrays.
Q9: What is the difference between app ID and bundle ID?
Ans. An app ID is a two-part string used to identify one or more apps from a single development team. The string comprises a Team ID and a bundle ID search string, with a period (.) separating the two sections. The Team ID is provided by Apple and is unique to a specific development team.
The bundle ID uniquely recognizes the iOS application in Apple’s ecosystem and thus relevant for both OSX and iOS apps. This implies no two applications can have a similar bundle identifier. So to avoid conflicts, Apple urges developers to make use of reverse-DNS for choosing an application’s bundle identifier.
Q10: What is the framework that is used to construct an application user interface in iOS?
Ans. The UIKit framework is used to construct an application’s user interface for iOS. It provides event handling, windows, drawing model, views, and controls specially designed for a touch screen user interface. It also provides an application model for interacting with the system.
Q11: Which API is used to write the test scripts to exercise the application UI elements?
Q12: What is Spritkit and Scenekit?
Ans. SpriteKit is a framework for easy development of animated 2D objects While, SceneKit is a framework acquired from OS X that helps with 3D graphics rendering. The new wave of mobile games is expected to redefine the iOS devices powerful GPUs are offered through Scenekit, Spiritkit, and Metal.
Q13: Write the differences between assign and retain?
Ans. Assign: It is a keyword used to make a reference from one object to another. The retain count of the source does not increase.
Retain: It is used to create a reference from one object to another and increases the retain count of the source object.
Q14: Write the hierarchy from UIButton to NSObject?
Ans. UIButton acquires from UIControl, UIControl acquires from UIView, UIView acquires from UIResponder, UIResponder acquires from the root class NSObject.
Q15: Define layer objects?
Ans. Layer objects are data objects which represent visual content and are used by views to provide their content. Custom layer objects are also added to the interface to implement complex animations and other kinds of sophisticated visual effects.
Q16: What are iBeacons?
Ans. iBeacon is a protocol developed by Apple Inc. It implements the Bluetooth low energy (BLE) technology to create a new way of providing location-based information and services to iPhones and other Apple devices. When the apps installed on your iPhone listen out for the nearby Bluetooth signals transmitted by these beacons and thus responds accordingly.
Q17: What is an App ID?
Ans. An App ID is a unique identity that iOS used to connect an application to the Apple push notification service, shares data between the application, and allows you to connect with the external hardware devices that you want to connect to your iOS application.
Q18: What is NSError?
Ans. In Objective-C, error handling is provided with the NSError class that is available in the foundation framework. An error object conveys the more extensible errors to the user during run time by using the error code or the error string. It has three main components that are as follows:
Domain: The error domain can be pre-defined NSError domain or a string describing the domain
Code: An int value representing the error
User Info Dictionary: A dictionary containing all the additional information about the error.
Q19: What are the various ways that you can specify the layout of elements in a UIView?
Ans. The various ways to specify the layout of the element in UIView are as follows:
- You can mention the coordination of every element using CGRects and then you can pass the (id)initWithFrame:(CGRect)frame method of UIView.
- You can use your code along with NSLayoutConstraints to arrange the elements using AutoLayout.
- A storyboard for an application can be built using the InterfaceBuilder. You can also include a XIB file into your project, can arrange the layout within the file, and can load the file in your application code.
Q20: What are the features of the UIkit framework in iOS?
Ans. UIKit framework supports the following features:
- Print support
- PDF creation
- Motion and touch-based events
- Supports external displays along with graphics and windowing
- Content can be shared through email, Facebook, and Twitter.
Q21: What are the important features of iOS?
Ans. The most important features of iOS are as follows:
- Social media
- High-end processor
- Powerful API
- Notification center
- Game center
- In-app purchase
- Accessibility and many more
Q22: What are the various programming languages used for developing an iOS application?
Ans. The various programming languages used for developing an iOS application are as follows:
However, the official languages used for developing the iOS application are Objective-C and C.
Q23: Define ARC in iOS?
Ans. ARC stands for Automatic Reference Counting. This feature is used for handling the lifetime of the objects in Objective-C. It is a memory management technique for the C language compiler that is used by both Swift and Objective-C for reference counting. ARC stores the information about the instance class referred to variables, constants, and instance properties.
Q24: What are the different data types in Objective-C?
Ans. Objective-C has different types of data types are as follows:
Q25: Define NSOperation, NSOperationQueue, and NSBlockOperation?
Ans. NSOperation is an abstract class that can be used for adding dependencies to different operations, reuse, cancel, and suspend them. It can be used through the NSOperation subclasses.
NSOperationQueue is a queue that monitors the operations. These queued operations are executed by NSOperationQueue as per the requirement.
And, NSBlockOperation is a subgroup of NSOperation that deals with the execution of one or more tasks concurrently.
Q26: Define the Responder chain in iOS?
Ans. A sequence of responder objects is called the Responder Chain. The chain initially starts at the responder and ends at the application object. If the first responder cannot handle the event then it forwards to the next responder in the responder chain.
Q27: What is the importance of using @synchronized in Objective-C?
Ans. The @synchronized directive is used in Objective-C for ensuring that the only thread gets executed at any given point of time. It prevents one or more threads from accessing the same address in memory.
Q28: What do you understand about iOS?
Ans. iOS is the operating system that was developed by Apple Inc. for its devices such as smartphones, tablets, iPods, iPads, etc. It was termed as iOS after the launch of the iPad. 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 and was released on September 19, 2019.