Friday, July 27, 2012

iOS interview Questions (Part 2)

Well guys, It seems like I have covered most of the interview questions in iOS interview Questions(part1). So here the questions are less but I have also posted few helpful links(Good part is few of them also contains answers) I will update this post if I come under new questions.



1) What is Xcode and iPhone SDK?

2) What is the difference between retain and release?

3) Difference between retain and copy ?

4) Difference between delegate and datasource?

5) Any five delegate and datasource method of UITableView with their explanation ?

6) Explain delegation, categories, and subclassing. What are their pros/cons? Can you give examples where you would use one over the other?

7) Difference between sax parser and dom parser ?

8) What is atomic and non atomic ?

9) XML parsing procedure (NSXMLParser).

10) What is @synthesize?

11) Explain deep copy and shallow copy ?

12) Difference between pass by value and pass by reference ?

13) Write a simple prog to add data using SQLITE?

14) Write a simple prog to parse an xml file (xml file structure will be provided by the company)

15) What is a class difference between a class and a structure ?

16) Difference between table view and picker view?

17) Write a program, if u have two classes A and B. A contain some class and instance method and you have to invoke this method in B. Do it without using inheritance?

18) Difference between UIView and UIViewController ?

19) Steps to deploy an app into the device ?

20) Difference between protocol and delegate ?

21) Difference between C++ and Objective C ?

22) Explain stack and heap?

23) Why dynamic memory allocation is required?

24) Explain the types of Notification in iPhone ? and how to use them ?

25) Few Questions on your iPhone Project (if any)

26) Given an object of an unknown type, how would you determine its class? How would you check to see if it conforms to a given protocol? How would you check to see if it responds to a given message/selector?

27) Difference between frames and bounds ?

28) what is the difference between a synchronous and an asynchronous request ?

29) How to display different image from the server inside the table view ?

30) Difference between release and autorelease ?


Few other links to iPhone interview questions


1) http://www.applausible.com/blog/?p=654

2) http://iosfordummies.blogspot.in/

3) http://www.techipost.com/2012/06/13/iphone-interview-questions-and-answers/

4) http://anujbansal1810.blogspot.com/2011/08/c-is-sea.html

5) http://yoursiphone.blogspot.com/2010/08/interview-questions-part-2.html

6) http://placementpapers.net/helpingroot/Oops/Important-Interview-Questions-On-Object-Oriented-Programming-Concepts



I hope the above interview questions for iPhone help you to crack the interview and if they do then please let me know via comments or via mails, until then happy iCoding and have a great Day. Comments and Feedbacks are always welcome

Thursday, May 17, 2012

iOS interview Questions (Part 1)


I have seen lots of peoples asking on web about iOS interview questions. So I decided to gather up a list of iOS interview questions that could serve as a good starting point for Objective-C and Cocoa development topics. Also I intend to update this list later when i will have more information to add – hoping to build a comprehensive list of technical questions.Updated list available here in second part of tutorial.
So here I am with a list of possible iOS interview questions:

—- Objective-C related —-

  • identify basic OO concepts and the keywords Objective-C uses (interface, implementation, property, protocol, etc)
  • what is a designated initializer, what is the pattern for the initializers and why ( if (self = [super ...] ) )
  • basic memory management topics, like ownership retain/release/autorelease
    • what happens if you add your just created object to a mutable array, and you release your object
    • what happens if the array is released
    • what happens if you remove the object from the array, and you try to use it
  • trick: garbage collection on iPhone
  • autorelease pool usage
  • property declarations ( assign, nonatomic, readonly, retain, copy )
    • trick: ask about the nonexistent atomic keyword, what does atomic mean
    • ask on how to correctly implement a retaining setter property
    • ask about the circular reference problem and delegates being usually saved with assign rather then retain
  • what is the difference between the dot notation and using the square brackets
    • what happens when we invoke a method on a nil pointer
    • difference between nil and Nil
  • what is KVO and related theory + methods to use when observing
    • does KVO work with ivars too?
  • protocols – maybe: main difference between c#/java interface and protocols
    • what to do in a situation when a class doesn’t implement a method from a protocol
  • what about multiple class inheritance
  • what is fast enumeration
  • class methods vs instance methods
    • visibility of methods
  • what is an actual class in Objective-c (struct)
    • ask about the isa member
    • ask about isKindOfClass isMemberOfClass
  • root classes: NSObject, NSProxy
    • how does proxy-ing work
    • how to fake multiple class inheritance
  • id type
    • what happens during compilation if we invoke a method on an variable with the type id
    • what happens runtime if the method exists
    • what happens if the methods doesn’t exist
    • pro and cons of using the type id
    • what happens here(compile + runtime): NSString *s = [NSNumber numberWithInt:3]; int i = [s intValue];
  • what are class categories and the () category
  • what is an informal protocol
  • what is a delegate, how to create one, and use one
  • what is a selector, how to do a perform selector
    • how to delay executing a selector
    • what to do when the selector has more paramters (NSInvocation>
    • how to start a selector on a background thread
  • how to start a thread
    • what is the first thing to do on a thread (autorelease pool)
    • what is a runloop, and one very common place where it is used (timers, nsurlconnection)
  • how to download something from the internet
    • what is the difference between a synchronous and an asynchronous request
    • small task: explain how to download an image from the internet, and show this in an image view – all this after a button is tapped on the view
  • what are notifications, how to use them
  • what is a memory warning, how do we respond to it

—- A bit more advanced topics —-

  • when to use retainCount (never, and why)
  • why shouldn’t we invoke instance methods in an initializer and the dealloc
  • NSCoding, archiving
  • NSCopying, why can’t we simply use our own objects as key in a dictionary, what to do to solve the problem ( and the difference between a shallow and a deep copy)

—- UIKit related —-

  • what is a view, and a window
  • difference between a view’s bounds and frame
  • what is the resolution of the current available devices, difference between points and pixels (starting with iOS4)
  • what is the responder chain, becomeFirstResponder
  • what do IBOutlet and IBAction mean, what are they preprocessed to
  • how do tableviews function
  • what about multithreading and UIKit
  • what to do when the keyboard appears and hides some parts of the UI that are important
  • why should we release the outlets in viewDidUnload
  • what is awakeFromNib, what is the difference between a nib and a xib

—- CoreData —-

  • what is a context
  • what about multi threading and core data usage
  • what is an NSManagedObjectId – can we save it for later if the application was stopped
  • what types of stores does core data support
  • what is lazy loading, how does this relate to core data, situations when this can be handy
  • how to ready only a few attributes of an entity
  • what is an fetch result controller
  • how to synchronize contexts
  • how could one simulate an NSManagedObject (i’m thinking of the fact that all the properties are dynamic and not synthesized)
Okay – this probably is not a very organized list nor it is complete, but as i said i will get back and complete this list.
Also i would be really glad if you would drop a comment if you find this list useful, or want to add / correct something.

Wednesday, February 22, 2012

Fixing “Potential null dereference. According to coding standards in ‘Creating and Returning NSError Objects’ the parameter ‘error’ may be null” after running Analyzer

Real quick post- if you run static analyzer, Clang, etc and it’s giving you this issue, it’s an easy fix. The error references the documentation that you can look at: “Creating and Returning NSError Objects” -see section 3-5.

This is what the error will look like:

This is how you fix it:


Pretty simple just put an if statement around it to make sure error isn’t null already!

Just saw this:
http://stackoverflow.com/questions/1189518/clang-error-on-potential-null-dereference

Followers