Data Structures and Algorithms Multiple Choice Questions - Set 2

11.       In order to get the information stored in a BST in the descending order, one should traverse it in which of the following order?
(A) left, root, right
(B) root, left, right
(C) right, root, left
(D) right, left, root
Answer: C
12.       The following sorting algorithms maintain two sub-lists, one sorted and one to be sorted:
(A) Selection Sort
(B) Insertion Sort
(C) Merge Sort
(D) both (A) and (B)
Answer: D
13.       What does the following function do for a given Linked List with first node as head?
void fun1(struct node* head)
  if(head == NULL)
  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
Answer: B
14.       Is it possible to create a doubly linked list using only one pointer with every node?
(A) Not Possible
(B) Yes, possible by storing XOR of current node and next node
(C) Yes, possible by storing XOR of addresses of previous and next nodes.
(D) Yes, possible by storing XOR of current node and previous node
Answer: C
15.       Every internal node in a B-tree of minimum degree 2 can have
(A) 2, 3 or 4 children
(B) 1, 2 or 3 children
(C) 2, 4 or 6 children
(D) 0, 2 or 4 children
Answer: B
16.       Which sorting algorithm is the best if the list is already in order?
(A) Quick sort
(B) Merge sort
(C) Insertion sort
(D) None of these
Answer: C
17.       In .............. the difference between the height of the left sub tree and height of right sub tree, for each node, is not more than one
(B) Complete Binary Tree
(C) AVL-tree
(D) Balanced Search tree
Answer: C
18.       If the array is already sorted, which of these algorithms will exhibit the best performance?
(A) Merge Sort
(B) Insertion Sort
(C) Quick Sort
(D) All of these
Answer: B
19.       Queue data structure works on ..............
(D) None of these
Answer: B
20.    The number of comparisons required to sort 5 numbers in ascending order using bubble sort is
(A) 7
(B) 6
(C) 10
(D) 5
Answer: C

Post a Comment