Tuesday, 13 May 2014

Authentication



//LoginViewController.h

#import <UIKit/UIKit.h>

@interface LoginViewController : UIViewController {
    IBOutlet UITextField *usernameField;
    IBOutlet UITextField *passwordField;
    IBOutlet UIButton *loginButton;
}

@property (nonatomic, retain) UITextField *usernameField;
@property (nonatomic, retain) UITextField *passwordField;
@property (nonatomic, retain) UIButton *loginButton;

- (IBAction) login: (id) sender;

@end

//LoginViewController.m


#import "LoginViewController.h"

@implementation LoginViewController

@synthesize usernameField, passwordField, oginButton, loginIndicator;

- (IBAction) login: (id) sender
{
    if([usernameField.text length] > 0 && [passwordField.text length] > 0){

        if([usernameField.text isEqualToString:@"admin"] && [passwordField.text isEqualToString:@"admin"]){

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Authentication Success" message:@"Login Successful" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];

        } else {

            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Authentication Failed" message:@"Please check the username and password" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
            [alert show];

        }
    }
}

Saturday, 5 April 2014



Write a program to create result of student using if-else & switch.

studentsViewController.h

 #import <UIKit/UIKit.h>

@interface studentsViewController : UITableViewController

@end


studentsViewController.m

#import "studentsViewController.h"

@interface studentsViewController ()

@end

@implementation studentsViewController{
    NSMutableArray *students;
}

- (void)viewDidLoad {
    [super viewDidLoad];
   
    students = [[NSMutableArray alloc]initWithObjects:
                                                   @{@"name": @"Student 1", @"percentage": @"40"},
                                                   @{@"name": @"Student 2", @"percentage": @"50"},
                                                   @{@"name": @"Student 3", @"percentage": @"60"}, nil];
   
    self.tableView.rowHeight = 60;
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    // Return the number of sections.
    return 0;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    // Return the number of rows in the section.
    return [students count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *CellIdentifier = @"Cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath];
   
    NSDictionary *dict = [students objectAtIndex:indexPath.row];
   
    int per = [[dict objectForKey:@"percentage"] integerValue];
   
    NSString *grade;
    if(per >= 75){
        grade = @"A";
    } else if(per >= 60 && per<75){
        grade = @"B";
    } else {
        grade = @"C";
    }
   
   
    UILabel *nameLbl = [[UILabel alloc]init];
    nameLbl.textColor = [UIColor blackColor];
    nameLbl.text = [dict objectForKey:@"name"];
    nameLbl.font = [UIFont boldSystemFontOfSize:20];
    nameLbl.frame = CGRectMake(15, 7, 220, 25);
    [cell addSubview:nameLbl];
   
    UILabel *percentageLbl = [[UILabel alloc]init];
    percentageLbl.textColor = [UIColor grayColor];
    percentageLbl.text = [dict objectForKey:@"percentage"];
    percentageLbl.font = [UIFont boldSystemFontOfSize:16];
    percentageLbl.frame = CGRectMake(15, 33, 220, 21);
    [cell addSubview:percentageLbl];
   
    UILabel *gradeLbl = [[UILabel alloc]init];
    gradeLbl.textColor = [UIColor blackColor];
    gradeLbl.text = grade;
    gradeLbl.font = [UIFont boldSystemFontOfSize:18];
    gradeLbl.frame = CGRectMake(229, 21, 30, 21);
    [cell addSubview:gradeLbl];
   
    return cell;
}

@end


Friday, 4 April 2014

QuestionBank for iOS

1.What is latest iOS version?

7.1 is latest os for iPhone


 






2.What is latest Xcode version? 

Xcode Version 5.0 (5A1413)
4.What is iPad screen size?
 Both the iPad and the iPad 2 have an IPS display with a screen resolution of 1024x768.
5.what is iPhone screen size?
The iPhone screen resolution is…320×480  (320 x 480 pts)
The iPhone 4 screen resolution is…640×960 (320 x 480 pts)
The iPhone 5 screen resolution is…640×1136(320 x 568 pts)
Refer : http://www.idev101.com/code/User_Interface/sizes.html

6.What are the features is IOS 6?

 Refer : 
  • http://lifehacker.com/5944961/top-10-secret-features-of-ios-6/all
  • https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS6.html

The new features range from brand-new maps, Facebook integration to Passbook and FaceTime over cellular. Here's a look at 10 new features that you will get as part of iOS 6.
1. Maps
Perhaps the biggest change for a normal iOS user. Apple has ditched Google provided maps in iOS 6 and has introduced its own maps. The maps bring turn-by-turn navigation, 3D maps, real-time traffic information and more, however not all the maps features will be available in every market.
One of the interesting features of new maps app on iOS 6 is Flyover. With Flyover you can see select major metro areas from the air with photo-realistic, interactive 3D views.
2. Improved Siri
Siri has been on iPhone 4S for last one year, but now it is reaching more devices and with more features. With iOS 6, Siri understand more languages and can give answers to your movie, sports and restaurants related queries as well. It can also now post to your Facebook and Twitter accounts.
A new interesting addition to Siri is Eyes free, Apple is working with car manufacturers to integrate Siri into select voice control systems. Through the voice command button on your steering wheel, you'll be able to ask Siri questions without taking your eyes off the road.
3. Facebook Integration
Similar to the Twitter integration in iOS, Apple has also Facebook in iOS 6. With this integration in place, you will be able share a photo to Facebook right from camera app or post your location directly from maps. Facebook events also get integrated to your device calendar and same is the case with contact information from Facebook.
You will have sign in Facebook only once and then you can use also these features and more from any app without signing in again.
4. Shared Photo Streams
With shared photo streams, you can selectively share photos with a bunch of people. All you have to do is select photos from Photos app, tap the Share button, choose the people with whom you want to share these photos and you are done. If your friends and family are using Photos app or iPhoto, they will get the shared photos instantly in the apps, while the non-iOS/ Mac device users will be able to see them on web.
5. FaceTime over cellular
Along with Wi-Fi networks, you can also use FaceTime over cellular networks now. You can also make and receive FaceTime calls on your iPad using your phone number.
Apple has enhanced FaceTime so that you can receive FaceTime alerts across all of your devices. That means you can use FaceTime wherever you are, on any device. And never miss another FaceTime call.
6. Safari & Mail improvements
Apple has further enhanced the web browsing experience on iOS devices with iOS 6. A new feature called iCloud Tab keeps track of which web pages you have open on your devices, so even you if switch devices, you can just pick up from where you left on the other device. Safari can also save the full web pages now for reading later or offline access. The full screen support is finally present, all you have to do is turn your iOS device in landscape mode and just tap the full-screen button. Safari also gets the ability to upload photos via a form.
Mail is also improved with new features like VIP lists. You can now designate certain contacts as VIPs and chose to be notified when they email, even when email notifications are off. The VIP lists are cloud-enabled, so your boss or mom will still be VIP no matter which iCloud-enabled device you are using. Also included is swipe to refresh and an improved way to add videos or photos to email messages.
7. Panoramic photos
iOS 6 users using iPhone 4S, iPhone 5, or iPod touch (5th gen.) will benefit from the all new camera app that adds a panorama view. Until now you had to use third-party apps to get panoramic photos, but now with one simple motion you can shoot up to 240 degrees of view and watch the software weave its magic.
8. Better App Store
Apple has revamped the App Store interface on iOS devices. You will now have access to more information about each app and you will no longer have to enter a password for the free app updates. The company has also made changes to way the search results and Genius recommendations are displayed.
9. Phone & DND
What is a smartphone without a phone and in order to make calling cooler, Apple has made some changes in the Phone app in iOS6. Now when you decline an incoming call on iPhone, you can instantly reply with a text message or set a call-back reminder. With iOS 6, you will also be able to turn on Do Not Disturb to suppress all incoming calls and notifications except for the VIP contacts.
10. Passbook
If you are tired of managing all the passes or loyalty cards, Apple's new Passbook is to your rescue. With Passbook, you can store your boarding passes, movie tickets, retail coupons, loyalty cards, and more in one place. With the app, you will be able to just scan your iPhone or iPod touch to check in for a flight, get into a movie, and redeem a coupon. Apart from all this, Passbook will tell you when your coupons are expiring or balance left on your cards.
While Apple has introduced some really nice features in iOS 6, not all users will be able benefit as some of them don't work in all markets. Read our previous report on which iOS 6 feature work and don't work in India.


7.Who invented Objective c?
 
Objective-C was created primarily by Brad Cox and Tom Love in the early 1980s at their company Stepstone.
As a language, Objective-C has a long history. It was created at the Stepstone company in the early 1980s by Brad Cox and Tom Love. It was licensed by NeXT Computer Inc. in the late 1980s to develop the NeXTStep frameworks that preceded Cocoa. NeXT extended the language in several ways, for example, with the addition of protocols.


8.What is Cococa and cocoa touch?

Cocoa Touch is a user interface framework provided by Apple for building software applications for products like iPhone, iPad and iPod Touch. It is primarily written in Objective C language and is based on Mac OS X. Cocoa Touch was developed based on model view controller software architecture. The high-level application programming interfaces available in Cocoa Touch help to make animation, networking, and adding the appearance and behavior of the native platform to the developed applications possible with less code development.

The main difference between Cocoa and Cocoa touch is that the UI classes and APIs aren't the same as Mac OS X, so instead of NSTextField, you have UITextField. Many of the classes share the same functionality and can be ported quite easily by simply changing the class name, though most will require some more changes, but usually nothing too heavy.

There are also some differences between the Foundation frameworks in Cocoa and Cocoa Touch, most commonly missing classes, eg, Cocoa has NSHost and Cocoa Touch doesn't.
You will come to know more of the nuances between the two and will soon be able to instinctively know what will work on an iPhone with little/no modification and what will require some work to port between, but it's not that difficult.

9.What is Objective c?

Objective-C is the primary programming language you use when writing software for OS X and iOS. It’s a superset of the C programming language and provides object-oriented capabilities and a dynamic runtime. Objective-C inherits the syntax, primitive types, and flow control statements of C and adds syntax for defining classes and methods. It also adds language-level support for object graph management and object literals while providing dynamic typing and binding, deferring many responsibilities until runtime.

10. how declare methods in Objective c? and how to call them?


 Refer this Blog : http://jojitsoriano.wordpress.com/2010/08/06/declaring-objective-c-methods/
Methods are functions that are defined in a class. Objective-C supports two types of methods — instance methods and class methods.

Instance methods can be called only using an instance of the class; and they are prefixed with the minus sign (-) character. 


Class methods can be invoked directly using the class name and do not need an instance of the class in order to work. Class methods are prefixed with the plus sign (+) character.

The following code sample shows SomeClass with three instance methods and one class method declared: 


Defining a Method:
The general form of a method definition in Objective-C programming language is as follows:
 
- (return_type) method_name:( argumentType1 )argumentName1 
joiningArgument2:( argumentType2 )argumentName2 ... 
joiningArgumentn:( argumentTypen )argumentNamen 
{
   body of the function
}
 
A method definition in Objective-C programming language consists of a method header and a method body. Here are all the parts of a method:
  • Return Type: A method may return a value. The return_type is the data type of the value the function returns. Some methods perform the desired operations without returning a value. In this case, the return_type is the keyword void.
  • Method Name: This is the actual name of the method. The method name and the parameter list together constitute the method signature.
  • Arguments: A argument is like a placeholder. When a function is invoked, you pass a value to the argument. This value is referred to as actual parameter or argument. The parameter list refers to the type, order, and number of the arguments of a method. Arguments are optional; that is, a method may contain no argument.
  • Joining Argument: A joining argument is to make it easier to read and to make it clear while calling it.
  • Method Body: The method body contains a collection of statements that define what the method does.


//---SomeClass.h---

#import <Foundation/Foundation.h>

@class AnotherClass; //---forward declaration---

@interface SomeClass : NSObject { //---an object from AnotherClass--- AnotherClass *anotherClass;
     
float rate;
     
NSString *name;


}

//---instance methods---

-(void) doSomething;
-(
void) doSomething:(NSString *) str;
-(
void) doSomething:(NSString *) str withAnotherPara:(float) value;


//---class method---

+(void) alsoDoSomething; @end 

- how to call them :



To invoke the three instance methods, you first need to create an instance of the class and then call them using the instance created:
SomeClass *someClass = [SomeClass alloc];
[someClass
doSomething];
[someClass
doSomething:@”some text”];
[someClass
doSomething:@”some text” withAnotherPara:9.0f];

Class methods can be called directly using the class name, as the following shows:
[SomeClass alsoDoSomething];
In general, you create instance methods when you need to perform some actions that are related to the particular instance of the class (that is, the object). For example, suppose you defined a class that represents the information of an employee. You may expose an instance method that enables you
to calculate the overtime wage of an employee. In this case, you use an instance method because the calculation involves data specific to a particular employee object.

Class methods, on the other hand, are commonly used for defining helper methods. For example, you might have a class method called GetOvertimeRate: that returns the rate for working overtime. In a scenario in which all employees get the same rate for working overtime (assuming this is the case for your company), there is no need to create instance methods, and thus a class method will suffice. 


11. What is property in Objective c? 

Please refer the Book which i already provided to you for this question.
An object’s properties let other objects inspect or change its state. But, in a well-designed object-oriented program, it’s not possible to directly access the internal state of an object. Instead, accessor methods (getters and setters) are used as an abstraction for interacting with the object’s underlying data.









Interacting with a property via accessor methods
The goal of the @property directive is to make it easy to create and configure properties by automatically generating these accessor methods. It allows you to specify the behavior of a public property on a semantic level, and it takes care of the implementation details for you.
This module surveys the various attributes that let you alter getter and setter behavior. Some of these attributes determine how properties handle their underlying memory, so this module also serves as a practical introduction to memory management in Objective-C.

12.What is meaning of "copy" keyword?

copy
Makes a copy of an object, and returns it with retain count of 1. If you copy an object, you own the copy. This applies to any method that contains the word copy where “copy” refers to the object being returned.
"copy" is needed when the object is mutable. Use this if you need the value of the object as it is at this moment, and you don't want that value to reflect any changes made by other owners of the object. You will need to release the object when you are finished with it because you are retaining the copy.

13.What is meaning of "readOnly" keyword?

readwrite vs. readonly - "readwrite" is the default. When you @synthesize, both a getter and a setter will be created for you. If you use "readonly", no setter will be created. Use it for a value you don't want to ever change after the instantiation of the object.

14.What is meaning of "retain" keyword?

retain vs. copy vs. assign
  • "assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes.
  • "retain" is needed when the attribute is a pointer to an object. The setter generated by @synthesize will retain (aka add a retain count) the object. You will need to release the object when you are finished with it.
  • "copy" is needed when the object is mutable. Use this if you need the value of the object as it is at this moment, and you don't want that value to reflect any changes made by other owners of the object. You will need to release the object when you are finished with it because you are retaining the copy.

retain:
The retain keyword increases the reference count of an object by 1.
Consider a example:


NSString
*str = [[NSString alloc] initWithString:@”Hello”];

NSString *str2 = str;

Here, you do not own
str2 because you do not use the alloc keyword on the object. When str is

released, the str2 will no longer be valid.

To ensure that
str2 is available even if str is released, you need to use the retain keyword:


NSString
*str = [[NSString alloc] initWithString:@”Hello”];
NSString
*str2 = str;
[str2
retain]; //---str2 now also “owns” the object---
[str release]; //---str can now be released safely---

In the preceding case, the reference count for str is now 2. When you release str, str2 will still be valid. When you are done with str2, you need to release it manually, like this:
[str2 release]; //---str2 can now be released when you are done with it---
15.What is meaning of "assign" keyword?"assign" is the default. In the setter that is created by @synthesize, the value will simply be assigned to the attribute. My understanding is that "assign" should be used for non-pointer attributes.
16.What is meaning of "automic" keyword?

REFER THIS : http://rdcworld-iphone.blogspot.in/2012/12/variable-property-attributes-or.html
assign
  • assign is the default and simply performs a variable assignment
  • assign is a property attribute that tells the compiler how to synthesize the property's setter implementation
  • I would use assign for C primitive properties and weak for weak references to Objective-C objects.
Example:
@property (nonatomic, assign) NSString *address;

@synthesize address;


17.What is meaning of "nonautomic" keyword?

 REFER THIS : http://rdcworld-iphone.blogspot.in/2012/12/variable-property-attributes-or.html

  1. nonatomic
    • Nonatomic means multiple thread access the variable(dynamic type).
    • Nonatomic is thread unsafe.
    • but it is fast in performance
    • Nonatomic is NOT default behavior,we need to add nonatomic keyword in property attribute.
    • it may result in unexpected behavior, when two different process (threads) access the same variable at the same time.
Example:
@property (nonatomic, retain) NSString *name;

@synthesize name;

18.What is difference between "assign" and "retain" keyword?REFER THIS : http://rdcworld-iphone.blogspot.in/2012/12/variable-property-attributes-or.html


retain = strong

  • it is retained, old value is released and it is assigned
  • retain specifies the new value should be sent -retain on assignment and the old value sent -release
  • retain is the same as strong.
  • apple says if you write retain it will auto converted/work like strong only.
  • methods like "alloc" include an implicit "retain"



Example:



@property (nonatomic, retain) NSString *name;



@synthesize name;



  assign 
  • assign is the default and simply performs a variable assignment
  • assign is a property attribute that tells the compiler how to synthesize the property's setter implementation
  • I would use assign for C primitive properties and weak for weak references to Objective-C objects.


Example:



@property (nonatomic, assign) NSString *address;



@synthesize address;


19.What is meaning of "synthesize" keyword ?
 
In the implementation file, rather than define the getter and setter methods, you can simply use the @synthesize keyword to get the compiler to automatically generate the getters and setters for you


20.What is "Protocol" on objective c?

a protocol declares a programmatic interface that any class can choose to implement. A protocol declares a set of methods, and an adopting class may choose to implement one or more of its declared methods. The class that defines the protocol is expected to call the methods in the protocols that are implemented by the adopting class.


21.What is use of UIApplication class? 

Refer this :https://developer.apple.com/library/ios/documentation/uikit/reference/UIApplication_Class/Reference/Reference.html
The UIApplication class provides a centralized point of control and coordination for apps running on iOS. Every app must have exactly one instance of UIApplication (or a subclass of UIApplication). When an app is launched, the UIApplicationMain function is called; among its other tasks, this function creates a singleton UIApplication object. Thereafter you access this object by invoking the sharedApplication class method.

Use this object to do the following:
  • Control the app’s response to changes in interface orientation.
  • Temporarily suspend incoming touch events.
  • Turn proximity sensing (of the user’s face) off and on again.
  • Register for remote notifications.
  • Trigger the undo-redo UI (applicationSupportsShakeToEdit).
  • Determine whether an installed app can open a URL (canOpenURL:).
  • Extend the execution of the app so that it can finish a task in the background.
  • Schedule and cancel local notifications.
  • Coordinate the reception of remote-control events.
  • Perform app-level state restoration tasks.
UIApplication defines a delegate that must adopt the UIApplicationDelegate protocol and implement some of the protocol methods.

22.What compilers apple using ?

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

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

Refer this :https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/Multithreading/ThreadSafety/ThreadSafety.html#//apple_ref/doc/uid/10000057i-CH8-SW16
The @synchronized directive is a convenient way to create mutex locks on the fly in Objective-C code.
The @synchronized directive does what any other mutex lock would do—it prevents different threads from acquiring the same lock at the same time.

24. What is the "interface" and "implementation"?

An interface declares the public properties and methods of a class, and the corresponding implementation defines the code that actually makes these properties and methods work


To declare a class, you use the @interface compiler directive, like this:
@interface
SomeClass : NSObject {
}

This is done in the header file (.h), and the class declaration contains no implementation. The preceding code declares a class named SomeClass, and this class inherits from the base class named NSObject.

In a typical View Controller class, the class inherits from the
UIViewController class, such as in the following:


@interface
HelloWorldViewController : UIViewController {
}



NOTE
While you typically put your code declaration in an .h file, you can also put it inside an .m if
need be. This is usually done for small projects.

NOTE NSObject is the root class of most Objective-C classes. It defines the basic interface of a class and contains methods common to all classes that inherit from it. NSObject also provides the standard memory management and initialization framework used by most objects in Objective-C, as well as reflection and type operations.


@implementation:
To implement a class declared in the header file, you use the @implementation compiler directive, like this:

#import
“SomeClass.h”

@implementation
SomeClass
@end


This is done in a separate file from the header file. In Objective-C, you define your class in an
.m file. Note that the class definition ends with the @end compiler directive.


25.What is "private", "Protected" and "Public" ?

By default, the access privilege of all fields is @protected. However, the access privilege can also be @public or @private. The following list describes the various access privileges:

  • ➤  @private — Visible only to the class that declares it
  • ➤  @public — Visible to all classes
  • ➤  @protected — Visible to the class that declares it and inheriting classes

26. What is the use of "dynamic" keyword?

@synthesize will generate getter and setter methods for your property.
@dynamic just tells the compiler that the getter and setter methods are implemented not by the class itself but somewhere else (like the superclass or will be provided at runtime).

Uses for @dynamic are e.g. with subclasses of NSManagedObject (CoreData) or when you want to create an outlet for a property defined by a superclass that was not defined as an outlet:
Super class.

@dynamic:
You use the @dynamic keyword to tell the compiler that you will fulfill the API contract implied by a property either by providing method implementations directly or at runtime using other mechanisms such as dynamic loading of code or dynamic method resolution. It suppresses the warnings that the compiler would otherwise generate if it can’t find suitable implementations. You should use it only if you know that the methods will be available at runtime.


27.What is "Delegate" ? 

Refer this :https://developer.apple.com/legacy/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CommunicatingWithObjects/CommunicateWithObjects.html

 A delegate is an object that acts on behalf of, or in coordination with, another object when that object encounters an event in a program. The delegating object is often a responder object—that is, an object inheriting from NSResponder in AppKit or UIResponder in UIKit—that is responding to a user event. The delegate is an object that is delegated control of the user interface for that event, or is at least asked to interpret the event in an application-specific manner

28.What is "notification"?

Refer this :https://developer.apple.com/library/mac/documentation/general/conceptual/devpedia-cocoacore/Notification.html
A notification is a message sent to one or more observing objects to inform them of an event in a program. The notification mechanism of Cocoa follows a broadcast model. It is a way for an object that initiates or handles a program event to communicate with any number of objects that want to know about that event. These recipients of the notification, known as observers, can adjust their own appearance, behavior, and state in response to the event. The object sending (or posting) the notification doesn’t have to know what those observers are. Notification is thus a powerful mechanism for attaining coordination and cohesion in a program. It reduces the need for strong dependencies between objects in a program (such dependencies would reduce the reusability of those objects). Many classes of the Foundation, AppKit, and other Objective-C frameworks define notifications that your program can register to observe.

The centerpiece of the notification mechanism is a per-process singleton object known as the notification center (NSNotificationCenter). When an object posts a notification, it goes to the notification center, which acts as a kind of clearing house and broadcast center for notifications. Objects that need to know about an event elsewhere in the application register with the notification center to let it know they want to be notified when that event happens. Although the notification center delivers a notification to its observers synchronously, you can post notifications asynchronously using a notification queue (NSNotificationQueue).









Broadcasting a notification


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

A protocol is an interface that a class can conform to, meaning that class implements the listed methods. A class can be tested for conformance to a protocol at compile-time and also at run-time using the conformsToProtocol:.. NSObject method.

A delegate is a more abstract term that refers to the Delegation Design Patten. Using this design pattern, a class would have certain operations that it delegates out (perhaps optionally). Doing so creates an alternative to subclassing by allowing specific tasks to be handled in an application-specific manner, which would be implemented by a delegate.

They are related terms because you often see a Protocol created for the purpose of delegation. If I wanted to allow a delegate to sort something, I'd create a Protocol with a required method listed such as "sortMyCoolStuff:.." and I would require the delegate to implement it. That way, within class that supports calling to a delegate, I can accept a pointer to a delegate and then can say "if that delegate conforms to myCoolProtocol, I know it implements sortMyCoolStuff, so it's safe to call that method instead of doing my built in behavior"


30.What is "Push Notification"?

  Push notifications—also known as remote notifications—arrive from outside a device. They originate on a remote server—the application’s provider—and are pushed to applications on devices (via the Apple Push Notification service) when there are messages to see or data to download.

Local notifications and push notifications are ways for an application that isn’t running in the foreground to let its users know it has information for them. The information could be a message, an impending calendar event, or new data on a remote server. When presented by the operating system, local and push notifications look and sound the same.
They can display an alert message or they can badge the application icon. They can also play a sound when the alert or badge number is shown.
When users are notified that the application has a message, event, or other data for them, they can launch the application and see the details. They can also choose to ignore the notification, in which case the application is not activated.


31. How to deal with SQLite database? 
 
32. What is storyboard?
Refer this : https://developer.apple.com/library/ios/documentation/general/conceptual/Devpedia-CocoaApp/Storyboard.html
A storyboard is a visual representation of the user interface of an iOS application, showing screens of content and the connections between those screens. A storyboard is composed of a sequence of scenes, each of which represents a view controller and its views; scenes are connected by segue objects, which represent a transition between two view controllers.

Xcode provides a visual editor for storyboards, where you can lay out and design the user interface of your application by adding views such as buttons, table views, and text views onto scenes. In addition, a storyboard enables you to connect a view to its controller object, and to manage the transfer of data between view controllers. Using storyboards is the recommended way to design the user interface of your application because they enable you to visualize the appearance and flow of your user interface on one canvas.
 
33. What is category in iOS? 
Refer this : https://developer.apple.com/library/ios/documentation/general/conceptual/devpedia-cocoacore/Category.html

You use categories to define additional methods of an existing class—even one whose source code is unavailable to you—without subclassing. You typically use a category to add methods to an existing class, such as one defined in the Cocoa frameworks. The added methods are inherited by subclasses and are indistinguishable at runtime from the original methods of the class. You can also use categories of your own classes to:
  • Distribute the implementation of your own classes into separate source files—for example, you could group the methods of a large class into several categories and put each category in a different file.
  • Declare private methods.
 
34. What is block in objective c?
Refer this : https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/Blocks/Articles/00_Introduction.html
Block objects are a C-level syntactic and runtime feature. They are similar to standard C functions, but in addition to executable code they may also contain variable bindings to automatic (stack) or managed (heap) memory. A block can therefore maintain a set of state (data) that it can use to impact behavior when executed.
You can use blocks to compose function expressions that can be passed to API, optionally stored, and used by multiple threads. Blocks are particularly useful as a callback because the block carries both the code to be executed on callback and the data needed during that execution.

 
35. How to parse XML? Explain in detail. 
Check the Blog post : http://www.sitepoint.com/parsing-xml-files-with-objective-c/
36. How to parse JSON? Explain in detail.
Refer this : http://blog.safaribooksonline.com/2013/03/06/parsing-json-in-objective-c-using-nsjsonserialization/
JSON is an easy standard to parse in client-server applications. It is easy to implement and simple to understand. With the release of the iOS 5 SDK, the NSJSONSerialization class was added in the SDK, which gives an easy to use delegate method, lifecycle, to parse JSON data.
The following post explains an easy example that fetches the twitter stream of a user (In this example I have fetched my own twitter stream: twitter.com/jadoon88) in a JSON format, and then parses the statuses and NSLogs them.

In the implementation file, inside viewDidLoad method, write the following code:

NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL
URLWithString:@"http://api.twitter.com/1/statuses/user_timeline.json?
screen_name=jadoon88"]];

The code above prepares the HTTP web request to a URL that returns a twitter stream in JSON format.

Next, in the same method, we will write code to perform the request and get a JSON response as NSData object. Add the following code below the code from above.

NSData *response = [NSURLConnection sendSynchronousRequest:request
returningResponse:nil error:nil];
 
Next, we will do the magic of serializing JSON. The following code fetches the JSON data in NSData object and serializes to an array. Add this code to the code above in the viewDidLoad method:

NSError *jsonParsingError = nil;
NSArray *publicTimeline = [NSJSONSerialization JSONObjectWithData:response
options:0 error:&jsonParsingError];
 
Next, just create an NSDictionary object that will store the twitter statuses. Add the following line of code where you have written the code above.

NSDictionary *tweet;
 
Now, we will iterate the elements in the array, filter out the “text” element in JSON data (that stores the twitter statuses) and NSLog it. The following code does the job:
for(int i=0; i<[publicTimeline count];i++)
{
 tweet= [publicTimeline objectAtIndex:i];
 NSLog(@”Statuses: %@”, [tweet objectForKey:@"text"]);
}
 
 
 
37. How to use reusable cell in UITableview?

38. What is the meaning of "strong" keyword?
39. What is the meaning of "weak" keyword?


40. What is difference strong and weak reference?

41. What manual memory management? How it works?
42. How to find the memory leaks in MRC?

43. What is an NSOperationQueue and how/would you use it? 

44. How to send crash report from device?
45. What is Thread class? How to use it?

46. What is autorelease pool?