IPhone Interview Questions & Answers

Ratings:
(4)
Views: 103
Banner-Img
Share this blog:

What is latest iOS version?

IOS - 6.1.3

What is latest Xcode version?

Xcode- 4.6.2

What is latest mac os version?

Mac- Mountain Lion

What are the features is IOS 6?

  1. Map: beautifully designed from the ground up (and the sky down)
  2. Integration of Facebook with iOS
  3. Shared photo streams.
  4. Passbook - boarding passes, loyalty cards, retail coupons, cinema tickets and more all in one place
  5. Facetime - on mobile network as wifi
  6. Changed Phone app - *remind me later,*reply with message.
  7. Mail - redesigned more streamline interface.
  8. Camera with panorama.

What is Cococa and cocoa touch?

Cocoa is for Mac App development and cocoa touch is for apples touch devices - that provide all development environments

What is Objective c?

*Objective-C is a reflective, object-oriented programming language which adds Smalltalk-style messaging to the C programming language. strictly superset of c.

How declare methods in Objective c? And how to call them?

 - (return_type) methodName :( data_type) parameter_name: (data_type) parameter_name

What is property in Objective c?

Property allow declared variables with specification like atomic/nonatmic, or retain/assign

What is meaning of "copy" keyword?

Copy object during assignment and increases retain count by 1

What is meaning of "readOnly" keyword?

Declare read only object / declare only getter method

What is meaning of "retain" keyword?

Specifies that retain should be invoked on the object upon assignment. takes ownership of an object

What is meaning of "assign" keyword?

Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float, int.

What is meaning of "atomic" keyword?

"Atomic", the synthesized setter/getter will ensure that a whole value is always returned from the getter or set by the setter, only single thread can access variable to get or set value at a time

What is meaning of "nonatomic" keyword?

In non atomic no such guaranty that value is returned from variable is same that setter sets. at same time

What is difference between "assign" and "retain" keyword?

Retain -Specifies that retain should be invoked on the object upon assignment. takes ownership of an object

Assign - Specifies that the setter uses simple assignment. Uses on attribute of scalar type like float,int.

What is meaning of "synthesize" keyword?

Ask the compiler to generate the setter and getter methods according to the specification in the declaration

What is "Protocol" on objective c?

A protocol declares methods that can be implemented by any class. Protocols are not classes themselves. They simply define an interface that other objects are responsible for implementing. Protocols have many advantages. The idea is to provide a way for classes to share the same method and property declarations without inheriting them from a common ancestor

What is use of UIApplication class?

The UIApplication class implements the required behavior of an application.

What compilers apple using?

The Apple compilers are based on the compilers of the GNU Compiler Collection.

What is synchronized () block in objective c? What is the use of that?

The @synchronized ()directive locks a section of code for use by a single thread. Other threads are blocked until the thread exits the protected code.

What is the "interface" and "implementation"?

Interface declares the behavior of class and implementation defines the behavior of class.

What is "private", "Protected" and "Public”?

Private - limits the scope class variable to the class that declares it.

Protected - Limits instance variable scope to declaring and inheriting classes.

Public - Removes restrictions on the scope of instance variables

What is the use of "dynamic" keyword?

Instructs the compiler not to generate a warning if it cannot find implementations of accessor methods associated with the properties whose names follow.

What is "Delegate”?

A delegate is an object that will respond to pre-chosen selectors (function calls) at some point in the future., need to implement the protocol method by the delegate object.

What is "notification"?

Provides a mechanism for broadcasting information within a program, using notification we can send message to other object by adding observer .

What is difference between "protocol" and "delegate"?

Protocol is used the declare a set of methods that a class that "adopts" (declares that it will use this protocol) will implement.

Delegates are a use of the language feature of protocols. The delegation design pattern is a way of designing your code to use protocols where necessary.

What is "Push Notification"?

To get the any update /alert from server.

What is storyboard?

With Storyboards, all screens are stored in a single file. This gives you a conceptual overview of the visual representation for the app and shows you how the screens are connected. Xcode provides a built-in editor to layout the Storyboards.

.storyboard is essentially one single file for all your screens in the app and it shows the flow of the screens. You can add segues/transitions between screens, this way. So, this minimizes the boilerplate  code required to manage multiple screens.

What is Category in Objective c?

A category allows you to add methods to an existing class—even to one for which you do not have the source.

What is block in objective c?

Blocks are a language-level feature added to C, Objective-C and C++, which allow you to create distinct segments of code that can be passed around to methods or functions as if they were values. Blocks are Objective-C objects, which means they can be added to collections like NSArray or NSDictionary. They also have the ability to capture values from the enclosing scope, making them similar to closures or lambdas in other programming languages.

How to parse xml? Explain in deep.

Using NSXMLParser. 

Create xml parser object with xml data, set its delegate , and call the parse method with parserObject.

Delegate methods getting called :

– parserDidStartDocument:

– parserDidEndDocument:

– parser:didStartElement:namespaceURI:qualifiedName:attributes:

– parser:didEndElement:namespaceURI:qualifiedName:

– parser:didStartMappingPrefix:toURI:

– parser:didEndMappingPrefix:

– parser:resolveExternalEntityName:systemID:

– parser:parseErrorOccurred:

– parser:validationErrorOccurred:

– parser:foundCharacters:

– parser:foundIgnorableWhitespace:

– parser:foundProcessingInstructionWithTarget:data:

– parser:foundComment:

– parser:foundCDATA:

How to parse JSON? Explain in deep.

By using NSJSONSerialization.

For example : NSArray *jsonArray = [NSJSONSerialization JSONObjectWithData: data options: NSJSONReadingMutableContainers error: &e];

How to use reusable cell in UITableview?

By using dequeReusableCellWithIdentifier

What is the meaning of "strong"keyword?

*strong -o "own" the object you are referencing with this property/variable. The compiler will take care that any object that you assign to this property will not be destroyed as long as you (or any other object) points  to it with a strong reference.

What is the meaning of "weak" keyword?

*Weak - weak reference you signify that you don't want to have control over the object's lifetime. The object you are referencing weakly only lives on because at least one other object holds a strong reference to it. Once that is no longer the case, the object gets destroyed and your weak property will automatically get set to nil.

What is difference strong and weak reference? Explain.

Complier with be responsible for lifetime of object which is declared as strong. for weak object - compiler will destroy object once strong reference that hold weak object get destroyed.

What is ARC? How it works? Explain in deep.

Automatic reference counting (ARC) If the compiler can recognize where you should be retaining and releasing objects, and put the retain and release statement in code.

What manual memory management?  How it work?

In Manual memory management developers is responsible for life cycle of object. Developer has to retain /alloc and release the object wherever needed.

How to find the memory leaks in MRC?

By using -

  1. Static analyzer.
  2. Instrument

What is use of NSOperation? How NSOperationque works?

An operation object is a single-shot object—that is, it executes its task once and cannot be used to execute it again. You typically execute operations by adding them to an operation queueAn NSOperationQueue object is a queue that handles objects of the NSOperation class type. An NSOperation object, simply phrased, represents a single task, including both the data and the code related to the task. The NSOperationQueue handles and manages the execution of all the NSOperation objects (the tasks) that have been added to it.

What is autorealease pool?

Every time -autorelease is sent to an object, it is added to the inner-most autorelease pool. When the pool is drained, it simply sends -release to all the objects in the pool.

Autorelease pools are simply a convenience that allows you to defer sending -release until "later". That "later" can happen in several places, but the most common in Cocoa GUI apps is at the end of the current run loop cycle.

Difference between nil and Nil?

Nil is meant for class pointers, and nil is meant for object pointers

What is fast enumeration?

for(id object in objets){

}

How to start a thread?

- (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg on NSObject

  NSThread* evtThread = [ [NSThread alloc] initWithTarget:self

                            selector:@selector( saySomething )

                          object:nil ];

    [ evtThread start ];

How to download something from the internet?

By Using NSURLConnection , by starting connection or sending synchronous request.

What is synchronous web request and asynchronous?

In synchronous request main thread gets block and control will not get back to user till that request gets execute.

In Asynchronous control gets back to user even if request is getting execute.

What are the ViewController lifecycle in ios?

LoadView - viewDidLoad-viewWillAppear-viewDidAppear - viewDisappear - viewDidUnload

Difference between coredata & sqlite?

There is a huge difference between these two. SQLLite is a database itself like we have MS SQL Server. But CoreData is an ORM (Object Relational Model) which creates a layer between the database and the UI. It speeds-up the process of interaction as we dont have to write queries, just work with the ORM and let ORM handles the backend. For save or retrieval of large data, I recommend to use Core Data because of its abilities to handle the less processing speed of IPhone.

Steps for using coredata?

NSFetchedResultsController - It is designed primarily to function as a data source for aUITableView

What are the Application lifecycle in ios?

ApplicationDidFinishLaunchingWithOption -ApplicationWillResignActive- ApplicationDidBecomeActive-ApplicationWillTerminate

Difference between release and autorelease?

Release - destroy the object from memory,

Autorelease - destroy the object from memory in future when it is not in use.

How to start a selector on a background thread?

- (void)performSelectorInBackground:(SEL)aSelector withObject:(id)arg on NSObject

What happens if the methods doesn’t exist?

App will crash with exception unrecognized selector sent to instance.

How Push notification works?

Server - Apple server - device by using APNs


 

You liked the article?

Like: 0

Vote for difficulty

Current difficulty (Avg): Medium

EasyMediumHardDifficultExpert
IMPROVE ARTICLEReport Issue

About Author

Authorlogo
Name
TekSlate
Author Bio

TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills in the market.

Stay Updated
Get stories of change makers and innovators from the startup ecosystem in your inbox