Monday, March 21, 2011

iPhone/iPad Technical Interview Question(FAQ) with answers(Part 1)

Q1.What is the iPhone Application Entry point?
A. The main function:
int main(int argc, char *argv[]) {
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

    int retVal = UIApplicationMain(argc, argv, nil, nil);
    [pool release];
    return retVal;
 }

Q2.What is the GUI Entry Point?
A. 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

    
    // Override point for customization after application launch.

    // Add the view controller's view to the window and display.
    [self.window addSubview:viewController.view];
    [self.window makeKeyAndVisible];

    return YES;
}

Q3.What is the Model structure of iPhone Application?
A.
@interface RootViewController : UITableViewController {
 NSArray *tableDataSource;

NSString *CurrentTitle;
NSInteger CurrentLevel;
IBOutlet UITableView * newsTable
UIActivityIndicatorView * activityIndicator
CGSize cellSize
NSMutableArray * stories
NSMutableDictionary * item;
NSString * currentElement
NSMutableString * currentTitle, * currentDate, * currentSummary, * currentLink
}

@property (nonatomic, retain) NSArray *tableDataSource;
@property (nonatomic, retain) NSString *CurrentTitle;
@property (nonatomic, readwrite) NSInteger CurrentLevel;



Q4.What is the View structure of iPhone Application?
A.
@interface loancalculatorViewController : UIViewController {
IBOutlet UITextField *tbxLoanAmount;
IBOutlet UITextField *annualInterestRate;
IBOutlet UITextField *noOfYears;
IBOutlet UILabel *monthlyPayment;
IBOutlet UILabel *totalInterest;
IBOutlet UILabel *totalPayment;
}

@property (nonatomic,retain) UITextField *tbxLoanAmount;
@property (nonatomic,retain) UITextField *annualInterestRate;
@property (nonatomic,retain) UITextField *noOfYears;
@property (nonatomic,retain) UILabel *monthlyPayment;
@property (nonatomic,retain) UILabel *totalInterest;
@property (nonatomic,retain) UILabel *totalPayment;


Q5.What is the Controller structure of iPhone Application?
A.

@interface RootViewController : UITableViewController {
mainView* myMainView;
}
- (id)init;
- (void)dealloc;
- (void)loadView;


Q6. What are Delegates in Objective-C?


A. 
A delegate allows one object to send messages to another object when an event happens.
OR
A delegate is a pointer to an object with a set of methods the delegate-holder knows how to call. In other words, it's a mechanism to enable specific callbacks from a later-created object.

For example: when we create an object of UITableView like: UITableView *myTable;
then some methods like:

didSelectRowAtIndexPath: 


automatically called. These methods are called delegated.

Q7. What is the need of these Delegates?
A.
 To execute some of must to do actions, we need these delegates.
For example: for a table it is must decided that, 
  • How many row will be there.
  • What will be the content on cell of each row.
  • What will happen after selecting the row.



Q8. How Memory Management is handle in iphone?



Q9. What is MVC ?
A.
MVC (Model View Controller) is a design pattern used in services architectures. MVC separate the software architecture into three distinct elements. The 'Model' is how the underlying data is structured. The 'View' is what is presented to the user or consumer. The 'Controller' is the element that performs the processing. More.....




Q10.  MVC supports loose or tight coupling?
A. 
MVC supports both loose and tight coupling, because there is usually a tight coupling
between the view and the controller because user actions are difficult to interpret without details of the presentation. For example:
   • What object mouse clicked on 
   • What text area user typed into
Actions must be interpreted in terms of presentation
View has the information to map points in view to application objects

Refer the figure in this post.
  
•    View needs to know about model. Controller needs to know about model and view, So view and the controller are tightly coupled.
•    Model doesn’t need to know about either’s design, So Model loosely coupled to view/controller


All The Best :)


Next(Part 2)….

6 comments:

  1. Hello,
    Before carrying out the strategy for the development of the iPad development, you need to understand the usability and additional features of the new technological revolution, the iPad. Since a higher form of the iPhone, iPad is also superior in terms of hardware and operating systems.

    ipad apps development

    ReplyDelete
  2. which lang.I have to learn first core java or c#
    rply soon

    ReplyDelete
  3. hello,can u help me wid using fb in app..like fb graph api..or using JSON to retrieve user's info...iam not getting any exact code or link from wher i can read this....

    ReplyDelete
  4. Hi Archana Thanks for posting valuable stuff, I am bit disagree about the delegate, just because all mentioned are not delegate of table view ,first three are datasource and did select is a delegate

    ReplyDelete
    Replies
    1. Hello Vipin, Thanks for recognize my mistake. I have corrected that.

      Delete