Wednesday, May 29, 2013

iPhone interview questions and Answers

# Whats the difference between frame and bounds?

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).  

# Whats a struct? 

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.  

#SAX (Simple API for XML)
  1. Parses node by node
  2. Doesn't store the XML in memory
  3. We can not insert or delete a node
  4. Top to bottom traversing

DOM (Document Object Model)
  1. Stores the entire XML document into memory before processing
  2. Occupies more memory
  3. We can insert or delete nodes
  4. Traverse in any direction

Soap Vs Rest

SOAP is definitely the heavyweight choice for Web service access. It provides the following advantages when compared to REST:
  • Language, platform, and transport independent (REST requires use of HTTP)
  • Works well in distributed enterprise environments (REST assumes direct point-to-point communication)
  • Standardized
  • Provides significant pre-build extensibility in the form of the WS* standards
  • Built-in error handling
  • Automation when used with certain language products
REST is easier to use for the most part and is more flexible. It has the following advantages when compared to SOAP:
  • No expensive tools require to interact with the Web service
  • Smaller learning curve
  • Efficient (SOAP uses XML for all messages, REST can use smaller message formats)
  • Fast (no extensive processing required)
  • Closer to other Web technologies in design philosophy

Delegation is a one to one relationship where one object implements a delegate protocol and another uses it and sends messages to assuming that those methods are implemented since the receiver promised to comply to the protocol. 
 KVO is many-to-many relationship where one object could broadcast a message and one or multiple other objects can listen to it and react.