iOS For Beginner

Interview Question- XCode & Framework

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

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

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

Question: Which API is used to write test scripts that help in exercising the application’s user interface elements?
Answer: 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.

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

Question: How can an operating system improve battery life while running an app?
Answer: 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 foreground app.

Question: Which framework delivers event to custom object when app is in foreground?
Answer: 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.

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

Question: Assume that your app is running in the foreground but is currently not receiving events. In which state it would be in?
Answer: 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.

Question: Give example scenarios when an application goes into InActive state?
Answer: 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.

Question: When an app is said to be in active state?
Answer: An app is said to be in active state when it is running in foreground and is receiving events.

Question: Name the app sate which it reaches briefly on its way to being suspended
Answer: An app enters background state briefly on its way to being suspended.

Question: Assume that an app is not in foreground but is still executing code. In which state will it be in?
Answer: Background state.

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

Question: How can you respond to state transitions on your app?
Answer: On state transitions can be responded to state changes in an appropriate way by calling corresponding methods on app’s delegate object.

For example:

● applicationDidBecomeActive method can be used to prepare to run as the foreground app.
● applicationDidEnterBackground method can be used to execute some code when app is running in the background and may be suspended at any time.
● applicationWillEnterForeground method can be used to execute some code when your app is moving out of the background
● applicationWillTerminate method is called when your app is being terminated.

Question: 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.

Question: Who calls the main function of you app during the app launch cycle?
Answer: 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.

Question: What is the use of controller object UIApplication?
Answer: 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 applevel logic.

Question: Which object is created 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.

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

Question: What happens if IApplication object does not handle an event?
Answer: In such case the event will be dispatched to your app delegate for processing.

Question: Which app specific objects store the app’s content?
Answer: 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.

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

Question: Which object manage the presentation of app’s content on the screen?
Answer: View controller objects takes care of the presentation of 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.

Question: Which is the superclass of all view controller objects?
Answer: 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.

Question: What is App Bundle?
Answer: When you build your iOS app, Xcode packages it as a bundle. A bundle is a directory in the file system that groups related resources together in one place. An iOS app bundle contains the app executable file and supporting resource files such as app icons, image files, and localized content.

Question: What is Cocoa ?
Answer: Cocoa is an application environment for both the Mac OS X operating system and iOS. It consists of a suite of object oriented software libraries, a runtime system, and an integrated development environment. Carbon is an alternative environment in Mac OS X, but it is a compatibility framework with procedural programmatic interfaces intended to support existing Mac OS X code bases.

Question: What frameworks that make Cocoa?
1. Appkit (Application Kit)
2. Foundation

Question: What is Application Kit/App kit?
Answer: The Application Kit is a framework containing all the objects you need to implement your graphical, event driven user interface: windows, panels, buttons, menus, scrollers and text fields. The Application Kit handles all the details for you as it efficiently draws on the screen, communicates with hardware devices and screen buffers, clears areas of the screen before drawing, and clips views

Question: What is Foundation Kit?
Answer: The Foundation framework defines a base layer of Objective C classes. In addition to providing a set of useful primitive object classes, it introduces several paradigms that define functionality not covered by the Objective C language. The Foundation framework is designed with these goals in mind:

● Provide a small set of basic utility classes.
● Make software development easier by introducing consistent conventions for things such as deallocation.
● Support Unicode strings, object persistence, and object distribution.
● Provide a level of OS independence, to enhance portability.

Question: What is Dynamic and Static Typing?
Answer: Static typed languages are those in which type checking is done at compile time, whereas dynamic typed languages are those in which type checking is done at runtime.

Objective C is a dynamically typed language, meaning that you don’t have to tell the compiler what type of object you’re working with at compile time. Declaring a type for a variable is merely a promise which can be broken at runtime if the code leaves room for such a thing. You can declare your variables as type id, which is suitable for any ObjectiveC object.

Question: What is Selectors?
Answer: In Objective C, selector has two meanings. It can be used to refer simply to the name of a method when it’s used in a sourcecode message to an object. It also, though, refers to the unique identifier that replaces the name when the source code is compiled. Compiled selectors are of type SEL. All methods with the same name have the same selector. You can use a selector to invoke a method on an object—this provides the basis for the implementation of the targetaction design pattern in Cocoa.

[friend performSelector:@selector(gossipAbout:) withObject:aNeighbor];

is equivalent to:

[friend gossipAbout:aNeighbor];

Question: Memory Management


Question: What is Helper Object?
Answer: Helper Objects are used throughout Cocoa and CocoaTouch, and usually take the form of a delegate or dataSource. They are commonly used to add functionality to an existing class without having to subclass it.

Question: What is Cluster Class?
Answer: Class clusters are a design pattern that the Foundation framework makes extensive use of. Class clusters group a number of private concrete subclasses under a public abstract superclass. The grouping of classes in this way simplifies the publicly visible architecture of an object oriented framework without reducing its functional richness.

Question: Differentiate Foundation vs Core Foundation
Answer: CoreFoundation is a general purpose C framework whereas Foundation is a general purpose Objective C framework. Both provide collection classes, run loops,etc, and many of the Foundation classes are wrappers around the CF equivalents. CF is mostly open source , and Foundation is closed source.

Core Foundation is the Clevel API, which provides CFString, CFDictionary and the like.Foundation is ObjectiveC, which provides NSString, NSDictionary, etc. CoreFoundation is written in C while Foundation is written in ObjectiveC. Foundation has a lot more classes CoreFoundation is the common base of Foundation and Carbon.

Question: Is AppDelegate is Singleton Class?
Answer: No, But its Obvious that AppDelegate is delegate of UIApplication and UIAPP is Singleton Class so there would be only one delegate as so one instance.

Question: What are Type of Notification ?
Client Point of View :
● Alert
● Sound
● Badge

Developer Point of View : 
● NSNotification
● APNS Apple Push Notification Service
● Local Notification
● KVO Key Value Observer.

Please login to get access to the quiz
Interview Question- Database (Prev Lesson)
Back to iOS For Beginner
Inquire Now
close slider