 A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

 1. The recurrence relation capturing the optimal time of the Tower of Hanoi problem with n discs is a. T(n) = 2T(n – 2) + 2 b. T(n) = 2T(n – 1) + n c. T(n) = 2T(n/2) + 1 d. T(n) = 2T(n – 1) + 1

 2. Consider a B+-tree in which the maximum number of keys in a node is 5. What is the minimum number of keys in any non-root node? a. 1 b. 2 c. 3 d. 4

 3. What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head == NULL) return; fun1(head->next); printf("%d ", head->data); } a. Prints all nodes of linked lists b. Prints all nodes of linked list in reverse order c. Prints alternate nodes of Linked List d. Prints alternate nodes in reverse order

 4. Which of the following points is/are true about Linked List data structure when it is compared with array a. Arrays have better cache locality that can make them better in terms of performance b. It is easy to insert and delete elements in Linked List c. Random access is not allowed in a typical implementation of Linked Lists d. All of the above

 5. Consider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that a node of doubly linked list has previous pointer as prev and next pointer as next. void fun(struct node **head_ref) { struct node *temp = NULL; struct node *current = *head_ref; while (current != NULL) { temp = current->prev; current->prev = current->next; current->next = temp; current = current->prev; } if(temp != NULL ) *head_ref = temp->prev; } Assume that reference of head of following doubly linked list is passed to above function 1 <--> 2 <--> 3 <--> 4 <--> 5 <-->6. What should be the modified linked list after the function call? a. 2 <--> 1 <--> 4 <--> 3 <--> 6 <-->5 b. 5 <--> 4 <--> 3 <--> 2 <--> 1 <-->6 c. 6 <--> 5 <--> 4 <--> 3 <--> 2 <--> 1 d. 6 <--> 5 <--> 4 <--> 3 <--> 1 <--> 2

 6. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity? a. Insertion Sort b. Quick Sort c. Heap Sort d. Merge Sort