Robosoft Technologies Interview Question

Memory management in iOS, protocols, linked list, trees?

Interview Answer

Anonymous

Apr 7, 2016

MEMORY MANAGEMENT IN IOS WAS INITIALLY NON-ARC (AUTOMATIC REFERENCE COUNTING ), WHERE WE HAVE TO RETAIN AND RELEASE THE OBJECT. NOW, IT SUPPORTS ARC AND WE HAVE DON'T HAVE TO RETAIN AND RELEASE THE OBJECT. AND THE X-CODE TAKE CARE OF THE JOB AUTOMATICALLY IN COMPILE TIME.. PROTOCOL:- A protocol which includes one method, notice the instance variable delegate is of type id, as it will be unknown at compile time the type of class that will adopt this protocol. #import @protocol ProcessDataDelegate @required - (void) processSuccessful: (BOOL)success; @end @interface ClassWithProtocol : NSObject { id delegate; } @property (retain) id delegate; -(void)startSomeProcess; @end LINKED LIST :-A linked list is a linear collection of data elements, called nodes pointing to the next node by means of a pointer. It is a data structure consisting of a group of nodes which together represent a sequence. TREES:- A tree is a widely used abstract data type (ADT)—or data structure implementing this ADT—that simulates a hierarchical tree structure, with a root value and subtrees of children with a parent node, represented as a set of linked nodes

1