Tuesday 2 July 2013

iphone Interview Questions and Answers Freshers

iphone Interview Questions and Answers Freshers 

Iphone interview questions

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

42.How is the app delegate is declared by Xcode project templates?

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

43.What happens if IApplication object does not handle an event?

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

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

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

46.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, window itself is never replaced.

47.Define view object.

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

48.You wish to define your custom view. Which class will be subclassed?

Custom views can be defined by subclassing UIView.

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

50.Which object manage the presentation of app’s content on the screen?

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.

51.Which is the super class 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.

52.What is the purpose of UIWindow object?

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

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

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

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

56.What are KVO and KVC?

KVC: Normally instance variables are accessed through properties or accessors but KVC gives another way to access variables in 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 value for that key. For example, you have employee class with name property.

You access property like

NSString age = emp.age;

setting 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 change in any of property is called KVO.

For example, person object is interested in getting notification when accountBalance property is changed in 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.

57.What is difference between NSNotification and delegate?

Delegate is passing message from one object to other object. It is like one to one communication while nsnotification is like passing 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 help of protocols.

58.What is 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 is not wasted. (Push Mechanism).

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

60.What is polymorphism?

This is very famous question and every interviewer asks this. Few people say polymorphism means multiple forms and they start giving example of draw function which is right to some extent but interviewer is looking for more detailed answer.

Ability of base class pointer to call function from derived class at runtime is called polymorphism.

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

62. Whats a struct?

A struct is a special C data type that encapsulates other pieces of data into a single cohesive unit. Like an object, but built into C. 

63.Whats 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 is the rectangle, expressed as a location (x,y) and size (width,height) relative to its own coordinate system (0,0).

0 comments:

Post a Comment