Breaking News
Loading...
Monday, February 25, 2013

51 IOS INTERVIEW QUESTIONS WITH ANSWERS

9:21 PM

Q1.What  is property?

Ans:Properties are used  to  access  the  instance  variables  from  outside  of  class.

Q2. What  is synthesized?

Ans:After  you  declare  the  property  in objective-c .  we  have to tell  the  compiler instantly  by  using  synthesize  directive. Actually  this  tells  to compiler  to generate  a  getter&setter  message.
3Q: How many bytes we can send to apple push notification server.
A:256bytes.


Q4. What is retaining?

Ans:It is reference count of the object

Q5. What is webservice?

Ans:Main  purpose is  to expose the data  in  form  of xml  format  ,by  using  this  we  can  getting  the  data  from  server.

Q6. What  is parsing?

Ans:To  access the data  in the  xml  element  is called  parsing.

Q7.Which class  we  can  use  for  passing  of xml  in  iphone?

Ans:By  “NSXML” Parser.

Q8.Which  type of  parse  we  have  use  in  iphone?

Ans:”SAX” parser.

Q9.Which  class are used to establish  connection  b/w application to webserver?

Ans:(a)NSURL
        (b)NSURL REQUEST
        (c)NSURL CONNECTION.

Q10.What  is difference between DOM&SAX?

Ans:(a)Dom is a documents based parser. When we will work with these parser all the data of xml is stored in RAM.In this parser  “memory consumption” is more.

(b)SAX  is  a  event  driven parser.When we will work with these parser,take only  reference  from  xml file  and  generate  the one event  for  every element.

Q11.After  parsing  if  you  want  to  get your data in  view  which  delegation  methods  are  did  you use?

Ans:(a)did  start  element      (b)did  end  elemen        (c)found  character.

Q12.How many  methods  are  used  in  NSURLConnection?

Ans:I  have 4 types methods
(a)Connection  did  receive  Response
(b)Connection  did  recevice  Datat
(c)Connection  fail  with error
(d)Connection  did  finish loading.

Q13.Tell  me  about  json-parser?

Ans:”JSON” Means  “Java script object notation”.
           It is a one  type  of  parser (or)test-based  and  hightweight  parser.

Q14.By  default application which  things  contain?

Ans:In ipone applications  by  default  having 3 things
1.main→It is  entry  point of  application.
2.Appdelegate→It is  perform  the  basic application  &  functionality.
3.Window→It  is  provide  uiinterface.

Q15.What is  uiviewcontroller?

Ans:   uiview controller  is base class for all the controller.

Q16. What is the navigation controller?

  Ans: Navigation  controller contains the stack of controllers every navigation controller
         must be having root view controller by default these controllers contain 2 method
         (a) push view      (b) pop view
        By default navigation controller contain “table view”.

Q17. What is tab bar controller?

 Ans: Tab bar is used to common way to display the data on iphone.

Q18. What is the table view controller?

Ans: Table view controller contains the number of rows and columns visible in the
        application  and makes a cell editable or not as a response to key press

Q19. Which protocols are did used in table view? 

Ans: Table view contain 2 delegate protocols
      (a). Ui table view data source
              (b). Ui table view delegate.
         In ui view table view data source contain these methods
               (a). No of sections.
               (b). No of rows in sections.
               (c). Cell for row index path row.
        In ui table view delegate contain these methods
               (a). Did select row at index path row

Q20. By default table view which controller contain?

Ans: Detail view controller that is present is ui table view delegate

Q21.  What is the split view controller?

Ans: This control is used for ipad application and it contain proper controllers by default  split view controller contain root view controller  and detail view controller.

Q22.  What are data base are used in iphone?

Ans: (a). Sql lite (b). Plist c). Xml (d). core data
          (

Q23. Tell me about the MVC architecture?

Ans: M-model, V-view, C-controller
         Main advantage of MVC architecture is to provide “reusability and security”
         by separating the layer by using MVC architecture.

         Model: it is a class model is interact with database.
         Controller: controller is used for by getting the data from model and controls the views.
         Viewdisplay the information in views.

Q24. What are frame works are used in iphone?

Ans:       (a). Ui kit framework
               (b). Map kit framework
               (c). ADI kit framework
               (d). Core data framework
               (e).core foundation framework

Q25. What is the instance methods?

Ans: Instance methods are essentially code routines that perform tasks so instances
        of clases we create methods to get and set the instance variables and to display
         the current values of these variables.

Declaration of instance method :
          - (void)click me: (id)sender;
          Void is return type which does not giving any thing here.
          Click me is method name.
          Id is data type which returns any type of object.

Q26. What is the class method?

Ans: Class methods work at the class level and are common to all instance of a
         class these methods are specific to the class overall as opposed to working
         on different instance data encapsulated in each class instance.
@interface class name :ns object
         {
          }
 +(class name *)new alloc:
 -(int)total open

Q27. What is data encapsulation?

Ans: Data is contained with in objects and is not accessible by any other than
         via methods defined on the class is called data encapsulation.

Q28. What is accessor  methods?

Ans: Accessor methods are methods belonging to a class that allow to get and set
         the values of instance valuables contained with in the class.

Q29. What is synthesized accessor methods?

Ans: Objective-c provides a mechanism that automates the creation of accessor
         methods that are called synthesized accessor methods that are
implemented through use of the @property and @synthesized.

Q30. How to access the encapsulated data in objective-c?

Ans:(a)Data encapsulation encourages the use of methods to +get and set the values of instance variables in a class.
 (b)But the developer to want to directly access an instance variable with out   having to go through an accessor method.        
(c) In objective-c syntax for an instance variable is as follow [class instance variable name]

Q31. What is dot notation?

Ans: Dot notation features introduced into version 2.0 of objective-c
         Dot notation involves accessing an instance variable by specifying
         a class “instance” followed by a “dot” followed in  turn by the name of instance variable or property to be accessed.

Q32. What is single inheritance in objective-c?

Ans: Objective-c subclass can only be derived from a single direct parent class this s concept is called as “single inheritance”.

Q33. Ns object is parent class or derived class?

Ans: Ns object is parent class and contains a number of instance variables and  instance methods.

Q34. How to call function in objective-c

Ans:   [account display account info]
           Account-> object namey Subclassing the UIView class.
  Display account info-> method name

35Q: What is App Bundle?
A:When you build your iOS app, Xcode packages it as a bundle. A bundle is a directory in the file system that groups related resources together in one place. An iOS app bundle contains the app executable file and supporting resource files such as app icons, image files, and localized content.
From your code, access your app’s resource files using an NSBundle object:
1. Use the mainBundle method of NSBundle to obtain your app’s main bundle object.
2. Use the methods of the bundle object to obtain the location of the desired resource file.
3. Open (or access) the file and use it.
The pathForResource:ofType: method is one of several NSBundle methods that you can use to retrieve the location of resource files in your bundle. The following example shows how to locate an image file called sun.png and create an image object. The first line gets the location of the file in the bundle. The second line creates theUIImage object using the data in the file at that location.
36Q: Whats fast enumeration?
A: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 reducesmessage send overhead and increases pipelining potential.)
37Q: Whats a struct?
A: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. *
38Q: Whats the difference between  NSArray and  NSMutableArray?
A:NSArrayʼs contents can not be modified once itʼs been created whereas a NSMutableArray can be modified as needed, i.e items can be added/removed from it.
39 Q: Explain retain counts.
A:Retain counts are the way in which memory is managed in Objective-C. When you create an object, it has a retain count of 1. When you send an object a retain message, its retain count is incremented by 1. When you send an object a release message, its retain count is decremented by 1. When you send an object a autorelease message, its retain count is decremented by 1 at some stage in the future. If an objectʼs retain count is reduced to 0, it is deallocated.
40Q: Whats the difference between frame and bounds?
A: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).
41 Q: Is a delegate retained?
A:No, the delegate is never retained! Ever!
 42Q: Outline the class hierarchy for a UIButton until NSObject. 
A:UIButton inherits from UIControl, UIControl inherits from UIView, UIView inherits from UIResponder, UIResponder inherits from the root class NSObject
  43Q: What is dynamic?
A: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
iOS Questions  for Intermediate level
44Q: If I call performSelector:withObject:afterDelay: – is the object retained?
A:Yes, the object is retained. It creates a timer that calls a selector on the current threads run loop. It may not be 100% precise time-wise as it attempts to dequeue the message fromthe run loop and perform the selector.
45Q: Can you explain what happens when you call autorelease on an object?
A:When you send an object a autorelease message, its retain count is decremented by 1 at some stage in the future. The object is added to an autorelease pool on the current thread. The main thread loop creates an autorelease pool at the beginning of the function, and release it at the end. This establishes a pool for the lifetime of the task. However, this also means that any autoreleased objects created during the lifetime of the task are not disposed of until the task completes. This may lead to the taskʼs memory footprint increasing unnecessarily. You can also consider creating pools with a narrower scope or use NSOperationQueue with itʼs own autorelease pool. (Also important – You only release or autorelease objects you own.)
46 Q: Whats the NSCoder class used for?
A:NSCoder is an abstractClass which represents a stream of data. They are used in Archiving and Unarchiving objects. NSCoder objects are usually used in a method that is being implemented so that the class conforms to the protocol. (which has something like encodeObject and decodeObject methods in them).
47 Q: Whats an NSOperationQueue and how/would you use it?
A:The NSOperationQueue class regulates the execution of a set of NSOperation objects. An operation queue is generally used to perform some asynchronous operations on a background thread so as not to block the main thread.
48Q: Explain the correct way to manage Outlets memory
A:Create them as properties in the header that are retained. In the viewDidUnload set the outlets to nil(i.e self.outlet = nil). Finally in dealloc make sure to release the outlet.
iOS Questions for  Expert level
49Q: Is the delegate for a CAAnimation retained?

A:Yes it is!! This is one of the rare exceptions to memory management rules.
50Q: What happens when the following code executes?
Ball *ball = [[[[Ball alloc] init] autorelease] autorelease];
A:It will crash because itʼs added twice to the autorelease pool and when it it dequeued the autorelease pool calls release more than once.
51 Q: Explain the difference between NSOperationQueue concurrent and non-concurrent.
A:In the context of an NSOperation object, which runs in an NSOperationQueue, the terms concurrent and non-concurrent do not necessarily refer to the side-by-side execution of threads. Instead, a non-concurrent operation is one that executes using the environment that is provided for it while a concurrent operation is responsible for setting up its own execution environment.

0 comments:

 
Toggle Footer