iphone Interview Questions part-6

51-Assume that system is running low on memory. What can system do for suspended apps?

In case system is running low on memory, the system may purge suspended apps without notice.

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

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

54-Who calls the main function of you 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.

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

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

57- How is the app delegate is declared by Xcode project templates?

App delegate is declared as a subclass of UIResponder by Xcode project templates.

58-What happens if IApplication object does not handle an event?

In such case the event will be dispatched to your app delegate for processing.

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

60-Are document objects required for an application? What does they offer?

Document objects are not required but are very useful in grouping data that belongs in a single file or file package.