Showing posts with label dynamic memory allocation. Show all posts
Showing posts with label dynamic memory allocation. Show all posts

Friday, May 12, 2017

Data structure in C with answers

Q.1 which of the fallowing reflects the correct definition of recursion?
            a) Calling of a function by some other function                         b) Calling of a function by main() function.
            c) Calling of a function by itself                                                   d) None of the above.

Q.2 which of the fallowing reflects the correct meaning of Dynamic memory allocation (DMA)?
            a) Memory allocation at Run time                                                b) Memory allocation at Compile time
            c) Memory allocation at Load time                                              d) None of the above

Q.3 which of the fallowing function is not used for dynamic memory allocation or de-allocation in C?
            a) malloc()                                                                                      b) calloc()
            c) free()                                                                                           d)getch()

Q.4 let us assume that List is a pointer pointing to the first node of singly linked list, and next is a pointer pointing to the next node of linked list then after the execution of the while loop given below List contains
While(List->next!=NULL)
List=List->next;
a)      List contains the address of first node of linked list       b) List contains the address of second last node linked list.
b)      List contains the address of second node linked list       d) List contains the address of last node of linked list.

Q.5 which of the following condition reflects that the Is full condition in Circular Queue where rear ,front and size are variable with their usual meaning in Circular queue
            a) if(front==(rear+1)mod size);                                                  b) if(rear==(front+1)mod size);
            c) if(rear==front);                                                                        d) if(rear==-1 && front==-1);

Q.6 Stack fallows which of the fallowing principle?
            a) FIFO                                                                                          b) LIFO
            c) Both a) and  b)                                                                          d) none of the above

Q.7 which of the fallowing condition reflects that the Is Empty condition in linear Queue where rear ,front and size are variable with their usual meaning in linear queue
            a) if(front==rear);                                                                           b) if(front!=rear);
            c) if(front+1==rear-1)                                                                     d) none of the above

Q.8 Queue fallows which of the following principle?
            a) FIFO                                                                                             b) LIFO
            c) Both a) and  b)                                                                             d) none of the above

Common data for question 9 & 10. A binary tree is given below:


Q.9 height of the binary tree is?
            a) 2                                                                                                      b) 3
            c) 4                                                                                                      d) 5

Q.10 number of leaf and non-leaf node in the binary tree respectively  is?
a) 4, 6                                                                                                 b) 6, 4

c) 5, 5                                                                                                 d)none of the above is correct

Search Aptipedia