1. | Which of these best describes an array? |
A. | A data structure that shows a hierarchical behaviour |
B. | Container of objects of similar types |
C. | Arrays are immutable once initialised |
D. | Array is not a data structure |
Answer» B. Container of objects of similar types |
2. | How do you initialize an array in C? |
A. | int arr[3] = (1,2,3); |
B. | int arr(3) = {1,2,3}; |
C. | int arr[3] = {1,2,3}; |
D. | int arr(3) = (1,2,3); |
Answer» C. int arr[3] = {1,2,3}; |
3. | How do you instantiate an array in Java? |
A. | int arr[] = new int(3); |
B. | int arr[]; |
C. | int arr[] = new int[3]; |
D. | int arr() = new int(3); |
Answer» C. int arr[] = new int[3]; |
4. | Which of the following is a correct way to declare a multidimensional array in Java? |
A. | int[] arr; |
B. | int arr[[]]; |
C. | int[][]arr; |
D. | int[[]] arr; |
Answer» C. int[][]arr; |
5. | When does the ArrayIndexOutOfBoundsException occur? |
A. | Compile-time |
B. | Run-time |
C. | Not an error |
D. | Not an exception at all |
Answer» B. Run-time |
6. | Which of the following concepts make extensive use of arrays? |
A. | Binary trees |
B. | Scheduling of processes |
C. | Caching |
D. | Spatial locality |
Answer» D. Spatial locality |
7. | What are the advantages of arrays? |
A. | Objects of mixed data types can be stored |
B. | Elements in an array cannot be sorted |
C. | Index of first element of an array is 1 |
D. | Easier to store elements of same data type |
Answer» D. Easier to store elements of same data type |
8. | What are the disadvantages of arrays? |
A. | Data structure like queue or stack cannot be implemented |
B. | There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size |
C. | Index value of an array can be negative |
D. | Elements are sequentially accessed |
Answer» B. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size |
9. | Assuming int is of 4bytes, what is the size of int arr[15];? |
A. | 15 |
B. | 19 |
C. | 11 |
D. | 60 |
Answer» D. 60 |
10. | In general, the index of the first element in an array is |
A. | 0 |
B. | -1 |
C. | 2 |
D. | 1 |
Answer» A. 0 |
11. | Elements in an array are accessed |
A. | randomly |
B. | sequentially |
C. | exponentially |
D. | logarithmically |
Answer» A. randomly |
12. | Which of the following is not a disadvantage to the usage of array? |
A. | Fixed size |
B. | There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size |
C. | Insertion based on position |
D. | Accessing elements at specified positions |
Answer» D. Accessing elements at specified positions |
13. | What is the time complexity of inserting at the end in dynamic arrays? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | Either O(1) or O(n) |
Answer» D. Either O(1) or O(n) |
14. | What is the time complexity to count the number of elements in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(n2) |
Answer» B. O(n) |
15. | What is the space complexity for deleting a linked list? |
A. | O(1) |
B. | O(n) |
C. | Either O(1) or O(n) |
D. | O(logn) |
Answer» A. O(1) |
16. | Which of these is not an application of linked list? |
A. | To implement file systems |
B. | For separate chaining in hash-tables |
C. | To implement non-binary trees |
D. | Random Access of elements |
Answer» D. Random Access of elements |
17. | Which of the following is false about a doubly linked list? |
A. | We can navigate in both the directions |
B. | It requires more space than a singly linked list |
C. | The insertion and deletion of a node take a bit longer |
D. | Implementing a doubly linked list is easier than singly linked list |
Answer» D. Implementing a doubly linked list is easier than singly linked list |
18. | What is the worst case time complexity of inserting a node in a doubly linked list? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(1) |
Answer» C. O(n) |
19. | What differentiates a circular linked list from a normal linked list? |
A. | You cannot have the ‘next’ pointer point to null in a circular linked list |
B. | It is faster to traverse the circular linked list |
C. | You may or may not have the ‘next’ pointer point to null in a circular linked list |
D. | Head node is known in circular linked list |
Answer» C. You may or may not have the ‘next’ pointer point to null in a circular linked list |
20. | What is the time complexity of searching for an element in a circular linked list? |
A. | O(n) |
B. | O(nlogn) |
C. | O(1) |
D. | O(n2) |
Answer» A. O(n) |
21. | Which of the following application makes use of a circular linked list? |
A. | Undo operation in a text editor |
B. | Recursive function calls |
C. | Allocating CPU to resources |
D. | Implement Hash Tables |
Answer» C. Allocating CPU to resources |
22. | Which of the following is false about a circular linked list? |
A. | Every node has a successor |
B. | Time complexity of inserting a new node at the head of the list is O(1) |
C. | Time complexity for deleting the last node is O(n) |
D. | We can traverse the whole circular linked list by starting from any point |
Answer» B. Time complexity of inserting a new node at the head of the list is O(1) |
23. | Consider a small circular linked list. How to detect the presence of cycles in this list effectively? |
A. | Keep one node as head and traverse another temp node till the end to check if its ‘next points to head |
B. | Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer advancing by one node at a time |
C. | Cannot determine, you have to pre-define if the list contains cycles |
D. | Circular linked list itself represents a cycle. So no new cycles cannot be generated |
Answer» B. Have fast and slow pointers with the fast pointer advancing two nodes at a time and slow pointer advancing by one node at a time |
24. | A linear collection of data elements where the linear node is given by means of pointer is called? |
A. | Linked list |
B. | Node list |
C. | Primitive list |
D. | Unordered list |
Answer» A. Linked list |
26. | What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? |
A. | O(1) |
B. | O(n) |
C. | θ(n) |
D. | θ(1) |
Answer» C. θ(n) |
27. | What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3) |
Answer» A. O(1) |
28. | What would be the asymptotic time complexity to find an element in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n4) |
Answer» B. O(n) |
29. | What would be the asymptotic time complexity to insert an element at the second position in the linked list? |
A. | O(1) |
B. | O(n) |
C. | O(n2) |
D. | O(n3) |
Answer» A. O(1) |
30. | The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used? |
A. | Singly linked list |
B. | Doubly linked list |
C. | Circular doubly linked list |
D. | Array implementation of list |
Answer» C. Circular doubly linked list |
31. | Which of the following c code is used to create new node? |
A. | ptr = (NODE*)malloc(sizeof(NODE)); |
B. | ptr = (NODE*)malloc(NODE); |
C. | ptr = (NODE*)malloc(sizeof(NODE*)); |
D. | ptr = (NODE)malloc(sizeof(NODE)); |
Answer» A. ptr = (NODE*)malloc(sizeof(NODE)); |
Chapter: Linear Data Structures -Stacks and Queues
32. | Process of inserting an element in stack is called |
A. | Create |
B. | Push |
C. | Evaluation |
D. | Pop |
Answer» B. Push |
33. | Process of removing an element from stack is called |
A. | Create |
B. | Push |
C. | Evaluation |
D. | Pop |
Answer» D. Pop |
34. | In a stack, if a user tries to remove an element from empty stack it is called |
A. | Underflow |
B. | Empty collection |
C. | Overflow |
D. | Garbage Collection |
Answer» A. Underflow |
35. | Pushing an element into stack already having five elements and stack size of 5, then stack becomes |
A. | Overflow |
B. | Crash |
C. | Underflow |
D. | User flow |
Answer» A. Overflow |
36. | Entries in a stack are “ordered”. What is the meaning of this statement? |
A. | A collection of stacks is sortable |
B. | Stack entries may be compared with the ‘<‘ operation |
C. | The entries are stored in a linked list |
D. | There is a Sequential entry that is one by one |
Answer» D. There is a Sequential entry that is one by one |
37. | Which of the following is not the application of stack? |
A. | A parentheses balancing program |
B. | Tracking of local variables at run time |
C. | Compiler Syntax Analyzer |
D. | Data Transfer between two asynchronous process |
Answer» D. Data Transfer between two asynchronous process |
38. | Consider the usual algorithm for determining whether a sequence of parentheses is balanced. Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order). The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation? |
A. | 1 |
B. | 2 |
C. | none |
D. | none |
Answer» B. 2 |
39. | What is the value of the postfix expression 6 3 2 4 + – *? |
A. | 1 |
B. | 40 |
C. | 74 |
D. | -18 |
Answer» D. -18 |
40. | The postfix form of the expression (A+ B)*(C*D- E)*F / G is? |
A. | AB+ CD*E – FG /** |
B. | AB + CD* E – F **G / |
C. | AB + CD* E – *F *G / |
D. | AB + CDE * – * F *G / |
Answer» C. AB + CD* E – *F *G / |
41. | The data structure required to check whether an expression contains balanced parenthesis is? |
A. | Stack |
B. | Queue |
C. | Array |
D. | Tree |
Answer» A. Stack |
42. | What data structure would you mostly likely see in a non recursive implementation of a recursive algorithm? |
A. | Linked List |
B. | Stack |
C. | Queue |
D. | Tree |
Answer» B. Stack |
43. | The process of accessing data stored in a serial access memory is similar to manipulating data on a |
A. | Heap |
B. | Binary Tree |
C. | Array |
D. | Stack |
Answer» D. Stack |
44. | The postfix form of A*B+C/D is? |
A. | *AB/CD+ |
B. | AB*CD/+ |
C. | A*BC+/D |
D. | ABCD+/* |
Answer» B. AB*CD/+ |
45. | Which data structure is needed to convert infix notation to postfix notation? |
A. | Branch |
B. | Tree |
C. | Queue |
D. | Stack |
Answer» D. Stack |
46. | The prefix form of A-B/ (C * D ^ E) is? |
A. | -/*^ACBDE |
B. | -ABCD*^DE |
C. | -A/B*C^DE |
D. | -A/BC*^DE |
Answer» C. -A/B*C^DE |
47. | What is the result of the following operation? Top (Push (S, X)) |
A. | X |
B. | X+S |
C. | S |
D. | none |
Answer» A. X |
48. | The prefix form of an infix expression (p + q) – (r * t) is? |
A. | + pq – *rt |
B. | – +pqr * t |
C. | – +pq * rt |
D. | – + * pqrt |
Answer» C. – +pq * rt |
49. | Which data structure is used for implementing recursion? |
A. | Queue |
B. | Stack |
C. | Array |
D. | List |
Answer» B. Stack |
51. | What should be done when a left parenthesis ‘(‘ is encountered? |
A. | It is ignored |
B. | It is placed in the output |
C. | It is placed in the operator stack |
D. | The contents of the operator stack is emptied |
Answer» C. It is placed in the operator stack |
52. | Which of the following is an infix expression? |
A. | (a+b)*(c+d) |
B. | ab+c* |
C. | +ab |
D. | abc+* |
Answer» A. (a+b)*(c+d) |
53. | What is the time complexity of an infix to postfix conversion algorithm? |
A. | O(N log N) |
B. | O(N) |
C. | O(N2) |
D. | O(M log N) |
Answer» B. O(N) |
54. | Which of the following statement is incorrect with respect to infix to postfix conversion algorithm? |
A. | operand is always placed in the output |
B. | operator is placed in the stack when the stack operator has lower precedence |
C. | parenthesis are included in the output |
D. | higher and equal priority operators follow the same condition |
Answer» C. parenthesis are included in the output |
55. | In infix to postfix conversion algorithm, the operators are associated from? |
A. | right to left |
B. | left to right |
C. | centre to left |
D. | centre to right |
Answer» B. left to right |
56. | A linear list of elements in which deletion can be done from one end (front) and insertion can take place only at the other end (rear) is known as a ? |
A. | Queue |
B. | Stack |
C. | Tree |
D. | Linked list |
Answer» A. Queue |
57. | The data structure required for Breadth First Traversal on a graph is? |
A. | Stack |
B. | Array |
C. | Queue |
D. | Tree |
Answer» C. Queue |
58. | A queue follows |
A. | FIFO (First In First Out) principle |
B. | LIFO (Last In First Out) principle |
C. | Ordered array |
D. | Linear tree |
Answer» A. FIFO (First In First Out) principle |
59. | Circular Queue is also known as |
A. | Ring Buffer |
B. | Square Buffer |
C. | Rectangle Buffer |
D. | Curve Buffer |
Answer» A. Ring Buffer |
60. | If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what order will they be removed? |
A. | ABCD |
B. | DCBA |
C. | DCAB |
D. | ABDC |
Answer» A. ABCD |
61. | A data structure in which elements can be inserted or deleted at/from both the ends but not in the middle is? |
A. | Queue |
B. | Circular queue |
C. | Dequeue |
D. | Priority queue |
Answer» C. Dequeue |
62. | A normal queue, if implemented using an array of size MAX_SIZE, gets full when |
A. | Rear = MAX_SIZE – 1 |
B. | Front = (rear + 1)mod MAX_SIZE |
C. | Front = rear + 1 |
D. | Rear = front |
Answer» A. Rear = MAX_SIZE – 1 |
63. | Queues serve major role in |
A. | Simulation of recursion |
B. | Simulation of arbitrary linked list |
C. | Simulation of limited resource allocation |
D. | Simulation of heap sort |
Answer» C. Simulation of limited resource allocation |
64. | Which of the following is not the type of queue? |
A. | Ordinary queue |
B. | Single ended queue |
C. | Circular queue |
D. | Priority queue |
Answer» B. Single ended queue |
65. | With what data structure can a priority queue be implemented? |
A. | Array |
B. | List |
C. | Heap |
D. | Tree |
Answer» D. Tree |
66. | Which of the following is not an application of priority queue? |
A. | Huffman codes |
B. | Interrupt handling in operating system |
C. | Undo operation in text editors |
D. | Bayesian spam filter |
Answer» C. Undo operation in text editors |
67. | What is the time complexity to insert a node based on key in a priority queue? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» C. O(n) |
68. | What is not a disadvantage of priority scheduling in operating systems? |
A. | A low priority process might have to wait indefinitely for the CPU |
B. | If the system crashes, the low priority systems may be lost permanently |
C. | Interrupt handling |
D. | Indefinite blocking |
Answer» C. Interrupt handling |
69. | Which of the following is not an advantage of priority queue? |
A. | Easy to implement |
B. | Processes with different priority can be efficiently handled |
C. | Applications with differing requirements |
D. | Easy to delete elements in any case |
Answer» D. Easy to delete elements in any case |
70. | What is the time complexity to insert a node based on position in a priority queue? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» C. O(n) |
71. | What is a dequeue? |
A. | A queue with insert/delete defined for both front and rear ends of the queue |
B. | A queue implemented with a doubly linked list |
C. | A queue implemented with both singly and doubly linked lists |
D. | A queue with insert/delete defined for front side of the queue |
Answer» A. A queue with insert/delete defined for both front and rear ends of the queue |
72. | What are the applications of dequeue? |
A. | A-Steal job scheduling algorithm |
B. | Can be used as both stack and queue |
C. | To find the maximum of all sub arrays of size k |
D. | To avoid collision in hash tables |
Answer» D. To avoid collision in hash tables |
73. | Which of the following properties is associated with a queue? |
A. | First In Last Out |
B. | First In First Out |
C. | Last In First Out |
D. | Last In Last Out |
Answer» B. First In First Out |
74. | In a circular queue, how do you increment the rear end of the queue? |
A. | rear++ |
B. | (rear+1) % CAPACITY |
C. | (rear % CAPACITY)+1 |
D. | rear– |
Answer» B. (rear+1) % CAPACITY |
76. | What is the time complexity of enqueue operation? |
A. | O(logn) |
B. | O(nlogn) |
C. | O(n) |
D. | O(1) |
Answer» D. O(1) |
77. | What is the need for a circular queue? |
A. | effective usage of memory |
B. | easier computations |
C. | to delete elements based on priority |
D. | implement LIFO principle in queues |
Answer» A. effective usage of memory |
78. | What is the space complexity of a linear queue having n elements? |
A. | O(n) |
B. | O(nlogn) |
C. | O(logn) |
D. | O(1) |
Answer» A. O(n) |
Chapter: Non Linear Data Structures – Trees
79. | What is the maximum number of children that a binary tree node can have? |
A. | 0 |
B. | 1 |
C. | 2 |
D. | 3 |
Answer» C. 2 |
80. | The following given tree is an example for? |
A. | Binary tree |
B. | Binary search tree |
C. | Fibonacci tree |
D. | none |
Answer» A. Binary tree |
81. | How many common operations are performed in a binary tree? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 |
82. | What is the traversal strategy used in the binary tree? |
A. | depth-first traversal |
B. | breadth-first traversal |
C. | random traversal |
D. | Priority traversal |
Answer» B. breadth-first traversal |
83. | How many types of insertion are performed in a binary tree? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» B. 2 |
84. | What operation does the following diagram depict? |
A. | inserting a leaf node |
B. | inserting an internal node |
C. | deleting a node with 0 or 1 child |
D. | none |
Answer» C. deleting a node with 0 or 1 child |
85. | How many bits would a succinct binary tree occupy? |
A. | n+O(n) |
B. | 2n+O(n) |
C. | n/2 |
D. | n |
Answer» B. 2n+O(n) |
86. | The average depth of a binary tree is given as? |
A. | O(N) |
B. | O(√N) |
C. | O(N2) |
D. | O(log N) |
Answer» D. O(log N) |
87. | How many orders of traversal are applicable to a binary tree (In General)? 3 |
A. | 1 |
B. | 4 |
C. | 2 |
D. | 3 |
Answer» D. 3 |
88. | If binary trees are represented in arrays, what formula can be used to locate a left child, if the node has an index i? |
A. | 2i+1 |
B. | 2i+2 |
C. | 2i |
D. | 4i |
Answer» A. 2i+1 |
89. | Using what formula can a parent node be located in an array? |
A. | (i+1)/2 |
B. | (i-1)/2 |
C. | i/2 |
D. | 2i/2 |
Answer» B. (i-1)/2 |
90. | Which of the following properties are obeyed by all three tree – traversals? |
A. | Left subtrees are visited before right subtrees |
B. | Right subtrees are visited before left subtrees |
C. | Root node is visited before left subtree |
D. | Root node is visited before right subtree |
Answer» A. Left subtrees are visited before right subtrees |
91. | For the tree below, write the pre-order traversal. |
A. | 2, 7, 2, 6, 5, 11, 5, 9, 4 |
B. | 2, 7, 5, 2, 6, 9, 5, 11, 4 |
C. | 2, 5, 11, 6, 7, 4, 9, 5, 2 |
D. | none |
Answer» A. 2, 7, 2, 6, 5, 11, 5, 9, 4 |
92. | For the tree below, write the post-order traversal. |
A. | 2, 7, 2, 6, 5, 11, 5, 9, 4 |
B. | 2, 7, 5, 2, 6, 9, 5, 11, 4 |
C. | 2, 5, 11, 6, 7, 4, 9, 5, 2 |
D. | none |
Answer» C. 2, 5, 11, 6, 7, 4, 9, 5, 2 |
93. | What is the time complexity of pre-order traversal in the iterative fashion? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(nlogn) |
Answer» B. O(n) |
94. | What is the space complexity of the post-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes) |
A. | O(1) |
B. | O(nlogd) |
C. | O(logd) |
D. | O(d) |
Answer» D. O(d) |
95. | To obtain a prefix expression, which of the tree traversals is used? |
A. | Level-order traversal |
B. | Pre-order traversal |
C. | Post-order traversal |
D. | In-order traversal |
Answer» B. Pre-order traversal |
96. | Consider the following data. The pre order traversal of a binary tree is A, B, E, C, D. The in order traversal of the same binary tree is B, E, A, D, C. The level order sequence for the binary tree is |
A. | A, C, D, B, E |
B. | A, B, C, D, E |
C. | A, B, C, E, D |
D. | D, B, E, A, C |
Answer» B. A, B, C, D, E |
97. | What is the possible number of binary trees that can be created with 3 nodes, giving the sequence N, M, L when traversed in post-order. |
A. | 15 |
B. | 3 |
C. | 5 |
D. | 8 |
Answer» C. 5 |
98. | The post-order traversal of a binary tree is O P Q R S T. Then possible pre-order traversal will be |
A. | T Q R S O P |
B. | T O Q R P S |
C. | T Q O P S R |
D. | T Q O S P R |
Answer» C. T Q O P S R |
99. | A binary search tree contains values 7, 8, 13, 26, 35, 40, 70, 75. Which one of the following is a valid post-order sequence of the tree provided the pre-order sequence as 35, 13, 7, 8, 26, 70, 40 and 75? |
A. | 7, 8, 26, 13, 75, 40, 70, 35 |
B. | 26, 13, 7, 8, 70, 75, 40, 35 |
C. | 7, 8, 13, 26, 35, 40, 70, 75 |
D. | 8, 7, 26, 13, 40, 75, 70, 35 |
Answer» D. 8, 7, 26, 13, 40, 75, 70, 35 |
101. | A full binary tree can be generated using |
A. | post-order and pre-order traversal |
B. | pre-order traversal |
C. | post-order traversal |
D. | in-order traversal |
Answer» A. post-order and pre-order traversal |
102. | The maximum number of nodes in a tree for which post-order and pre-order traversals may be equal is |
A. | 3 |
B. | 1 |
C. | 2 |
D. | any number |
Answer» B. 1 |
103. | The pre-order and in-order are traversals of a binary tree are T M L N P O Q and L M N T O P Q. Which of following is post-order traversal of the tree? |
A. | L N M O Q P T |
B. | N M O P O L T |
C. | L M N O P Q T |
D. | O P L M N Q T |
Answer» A. L N M O Q P T |
104. | Find the postorder traversal of the binary tree shown below. |
A. | P Q R S T U V W X |
B. | W R S Q P V T U X |
C. | S W T Q X U V R P |
D. | none |
Answer» C. S W T Q X U V R P |
105. | For the tree below, write the in-order traversal. |
A. | 6, 2, 5, 7, 11, 2, 5, 9, 4 |
B. | 6, 5, 2, 11, 7, 4, 9, 5, 2 |
C. | 2, 7, 2, 6, 5, 11, 5, 9, 4 |
D. | none |
Answer» A. 6, 2, 5, 7, 11, 2, 5, 9, 4 |
106. | For the tree below, write the level-order traversal. |
A. | 2, 7, 2, 6, 5, 11, 5, 9, 4 |
B. | 2, 7, 5, 2, 11, 9, 6, 5, 4 |
C. | 2, 5, 11, 6, 7, 4, 9, 5, 2 |
D. | none |
Answer» B. 2, 7, 5, 2, 11, 9, 6, 5, 4 |
107. | What is the space complexity of the in-order traversal in the recursive fashion? (d is the tree depth and n is the number of nodes) |
A. | O(1) |
B. | O(nlogd) |
C. | O(logd) |
D. | O(d) |
Answer» D. O(d) |
108. | What is the time complexity of level order traversal? |
A. | O(1) |
B. | O(n) |
C. | O(logn) |
D. | O(nlogn) |
Answer» B. O(n) |
109. | Which of the following graph traversals closely imitates level order traversal of a binary tree? |
A. | Depth First Search |
B. | Breadth First Search |
C. | Depth & Breadth First Search |
D. | Binary Search |
Answer» B. Breadth First Search |
110. | In a binary search tree, which of the following traversals would print the numbers in the ascending order? |
A. | Level-order traversal |
B. | Pre-order traversal |
C. | Post-order traversal |
D. | In-order traversal |
Answer» D. In-order traversal |
111. | The number of edges from the root to the node is called of the tree. |
A. | Height |
B. | Depth |
C. | Length |
D. | Width |
Answer» B. Depth |
112. | The number of edges from the node to the deepest leaf is called of the tree. |
A. | Height |
B. | Depth |
C. | Length |
D. | Width |
Answer» A. Height |
113. | What is a full binary tree? |
A. | Each node has exactly zero or two children |
B. | Each node has exactly two children |
C. | All the leaves are at the same level |
D. | Each node has exactly one or two children |
Answer» A. Each node has exactly zero or two children |
114. | What is a complete binary tree? |
A. | Each node has exactly zero or two children |
B. | A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from right to left |
C. | A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from left to right |
D. | A tree In which all nodes have degree 2 |
Answer» C. A binary tree, which is completely filled, with the possible exception of the bottom level, which is filled from left to right |
115. | What is the average case time complexity for finding the height of the binary tree? |
A. | h = O(loglogn) |
B. | h = O(nlogn) |
C. | h = O(n) |
D. | h = O(log n) |
Answer» D. h = O(log n) |
116. | Which of the following is not an advantage of trees? |
A. | Hierarchical structure |
B. | Faster search |
C. | Router algorithms |
D. | Undo/Redo operations in a notepad |
Answer» D. Undo/Redo operations in a notepad |
117. | In a full binary tree if number of internal nodes is I, then number of leaves L are? |
A. | L = 2*I |
B. | L = I + 1 |
C. | L = I – 1 |
D. | L = 2*I – 1 |
Answer» B. L = I + 1 |
118. | In a full binary tree if number of internal nodes is I, then number of nodes N are? |
A. | N = 2*I |
B. | N = I + 1 |
C. | N = I – 1 |
D. | N = 2*I + 1 |
Answer» D. N = 2*I + 1 |
119. | In a full binary tree if there are L leaves, then total number of nodes N are? |
A. | N = 2*L |
B. | N = L + 1 |
C. | N = L – 1 |
D. | N = 2*L – 1 |
Answer» D. N = 2*L – 1 |
120. | Which of the following is incorrect with respect to binary trees? |
A. | Let T be a binary tree. For every k ≥ 0, there are no more than 2k nodes in level k |
B. | Let T be a binary tree with λ levels. Then T has no more than 2λ – 1 nodes |
C. | Let T be a binary tree with N nodes. Then the number of levels is at least ceil(log (N + 1)) |
D. | Let T be a binary tree with N nodes. Then the number of levels is at least floor(log (N + 1)) |
Answer» D. Let T be a binary tree with N nodes. Then the number of levels is at least floor(log (N + 1)) |
121. | Which of the following is false about a binary search tree? |
A. | The left child is always lesser than its parent |
B. | The right child is always greater than its parent |
C. | The left and right sub-trees should also be binary search trees |
D. | In order sequence gives decreasing order of elements |
Answer» D. In order sequence gives decreasing order of elements |
122. | What is the speciality about the inorder traversal of a binary search tree? |
A. | It traverses in a non increasing order |
B. | It traverses in an increasing order |
C. | It traverses in a random fashion |
D. | It traverses based on priority of the node |
Answer» B. It traverses in an increasing order |
123. | What are the worst case and average case complexities of a binary search tree? |
A. | O(n), O(n) |
B. | O(logn), O(logn) |
C. | O(logn), O(n) |
D. | O(n), O(logn) |
Answer» D. O(n), O(logn) |
124. | What are the conditions for an optimal binary search tree and what is its advantage? |
A. | The tree should not be modified and you should know how often the keys are accessed, it improves the lookup cost |
B. | You should know the frequency of access of the keys, improves the lookup time |
C. | The tree can be modified and you should know the number of elements in the tree before hand, it improves the deletion time |
D. | The tree should be just modified and improves the lookup time |
Answer» A. The tree should not be modified and you should know how often the keys are accessed, it improves the lookup cost |
126. | The binary tree sort implemented using a self – balancing binary search tree takes time is worst case. | |
A. | O(n log n) | |
B. | O(n) | |
C. | O(n2) | |
D. | O(log n) | |
Answer» A. O(n log n) | ||
127. | An AVL tree is a self – balancing binary search tree, in which the heights of the two child sub trees of any node differ by |
A. | At least one |
B. | At most one |
C. | Two |
D. | At most two |
Answer» B. At most one |
128. | Associative arrays can be implemented using |
A. | B-tree |
B. | A doubly linked list |
C. | A single linked list |
D. | A self balancing binary search tree |
Answer» D. A self balancing binary search tree |
129. | Which of the following is a self – balancing binary search tree? |
A. | 2-3 tree |
B. | Threaded binary tree |
C. | AA tree |
D. | Treap |
Answer» C. AA tree |
130. | A self – balancing binary search tree can be used to implement |
A. | Priority queue |
B. | Hash table |
C. | Heap sort |
D. | Priority queue and Heap sort |
Answer» A. Priority queue |
131. | In which of the following self – balancing binary search tree the recently accessed element can be accessed quickly? |
A. | AVL tree |
B. | AA tree |
C. | Splay tree |
D. | Red – Black tree |
Answer» C. Splay tree |
132. | The minimum height of self balancing binary search tree with n nodes is |
A. | log2(n) |
B. | n |
C. | 2n + 1 |
D. | 2n – 1 |
Answer» A. log2(n) |
133. | What is an AVL tree? |
A. | a tree which is balanced and is a height balanced tree |
B. | a tree which is unbalanced and is a height balanced tree |
C. | a tree with three children |
D. | a tree with atmost 3 children |
Answer» A. a tree which is balanced and is a height balanced tree |
134. | Why we need to a binary tree which is height balanced? |
A. | to avoid formation of skew trees |
B. | to save memory |
C. | to attain faster memory access |
D. | to simplify storing |
Answer» A. to avoid formation of skew trees |
135. | What is the maximum height of an AVL tree with p nodes? |
A. | p |
B. | log(p) |
C. | log(p)/2 |
D. | P⁄2 |
Answer» B. log(p) |
136. | Given an empty AVL tree, how would you construct AVL tree when a set of numbers are given without performing any rotations? |
A. | just build the tree with the given input |
B. | find the median of the set of elements given, make it as root and construct the tree |
C. | use trial and error |
D. | use dynamic programming to build the tree |
Answer» B. find the median of the set of elements given, make it as root and construct the tree |
137. | What maximum difference in heights between the leafs of a AVL tree is possible? |
A. | log(n) where n is the number of nodes |
B. | n where n is the number of nodes |
C. | 0 or 1 |
D. | atmost 1 |
Answer» A. log(n) where n is the number of nodes |
138. | What is missing? |
A. | Height(w-left), x-height |
B. | Height(w-right), x-height |
C. | Height(w-left), x |
D. | Height(w-left) |
Answer» A. Height(w-left), x-height |
139. | Why to prefer red-black trees over AVL trees? |
A. | Because red-black is more rigidly balanced |
B. | AVL tree store balance factor in every node which costs space |
C. | AVL tree fails at scale |
D. | Red black is more efficient |
Answer» B. AVL tree store balance factor in every node which costs space |
140. | Which of the following is the most widely used external memory data structure? |
A. | AVL tree |
B. | B-tree |
C. | Red-black tree |
D. | Both AVL tree and Red-black tree |
Answer» B. B-tree |
141. | B-tree of order n is a order-n multiway tree in which each non-root node contains |
A. | at most (n – 1)/2 keys |
B. | exact (n – 1)/2 keys |
C. | at least 2n keys |
D. | at least (n – 1)/2 keys |
Answer» D. at least (n – 1)/2 keys |
142. | A B-tree of order 4 and of height 3 will have a maximum of keys. |
A. | 255 |
B. | 63 |
C. | 127 |
D. | 188 |
Answer» A. 255 |
143. | Five node splitting operations occurred when an entry is inserted into a B-tree. Then how many nodes are written? |
A. | 14 |
B. | 7 |
C. | 11 |
D. | 5 |
Answer» C. 11 |
144. | trees are B-trees of order 4. They are an isometric of trees. |
A. | AVL |
B. | AA |
C. | 2-3 |
D. | Red-Black |
Answer» D. Red-Black |
145. | What is the best case height of a B-tree of order n and which has k keys? |
A. | logn (k+1) – 1 |
B. | nk |
C. | logk (n+1) – 1 |
D. | klogn |
Answer» A. logn (k+1) – 1 |
146. | Which of the following is true? |
A. | larger the order of B-tree, less frequently the split occurs |
B. | larger the order of B-tree, more frequently the split occurs |
C. | smaller the order of B-tree, more frequently the split occurs |
D. | smaller the order of B-tree, less frequently the split occurs |
Answer» A. larger the order of B-tree, less frequently the split occurs |
147. | In a max-heap, element with the greatest key is always in the which node? |
A. | Leaf node |
B. | First node of left sub tree |
C. | root node |
D. | First node of right sub tree |
Answer» C. root node |
148. | What is the complexity of adding an element to the heap. |
A. | O(log n) |
B. | O(h) |
C. | O(log n) & O(h) |
D. | O(n) |
Answer» C. O(log n) & O(h) |
149. | The worst case complexity of deleting any arbitrary node value element from heap is |
A. | O(logn) |
B. | O(n) |
C. | O(nlogn) |
D. | O(n2) |
Answer» A. O(logn) |
151. | If we implement heap as min-heap, deleting root node (value 1)from the heap. What would be the value of root node after second iteration if leaf node (value 100) is chosen to replace the root at start. |
A. | 2 |
B. | 100 |
C. | 17 |
D. | none |
Answer» A. 2 |
152. | An array consists of n elements. We want to create a heap using the elements. The time complexity of building a heap will be in order of |
A. | O(n*n*logn) |
B. | O(n*logn) |
C. | O(n*n) |
D. | O(n *logn *logn) |
Answer» B. O(n*logn) |
Chapter: Non Linear Data Structures – Graphs
153. | Which of the following statements for a simple graph is correct? |
A. | Every path is a trail |
B. | Every trail is a path |
C. | Every trail is a path as well as every path is a trail |
D. | Path and trail have no relation |
Answer» A. Every path is a trail |
154. | For the given graph(G), which of the following statements is true? |
A. | G is a complete graph |
B. | G is not a connected graph |
C. | The vertex connectivity of the graph is 2 |
D. | none |
Answer» C. The vertex connectivity of the graph is 2 |
155. | What is the number of edges present in a complete graph having n vertices? |
A. | (n*(n+1))/2 |
B. | (n*(n-1))/2 |
C. | n |
D. | Information given is insufficient |
Answer» B. (n*(n-1))/2 |
156. | The given Graph is regular. |
A. | True |
B. | False |
C. | none |
D. | none |
Answer» A. True |
157. | A connected planar graph having 6 vertices, 7 edges contains regions. |
A. | 15 |
B. | 3 |
C. | 1 |
D. | 11 |
Answer» B. 3 |
158. | If a simple graph G, contains n vertices and m edges, the number of edges in the Graph G'(Complement of G) is |
A. | (n*n-n-2*m)/2 |
B. | (n*n+n+2*m)/2 |
C. | (n*n-n-2*m)/2 |
D. | (n*n-n+2*m)/2 |
Answer» A. (n*n-n-2*m)/2 |
159. | Which of the following properties does a simple graph not hold? |
A. | Must be connected |
B. | Must be unweighted |
C. | Must have no loops or multiple edges |
D. | Must have no multiple edges |
Answer» A. Must be connected |
160. | What is the maximum number of edges in a bipartite graph having 10 vertices? |
A. | 24 |
B. | 21 |
C. | 25 |
D. | 16 |
Answer» C. 25 |
161. | Which of the following is true? |
A. | A graph may contain no edges and many vertices |
B. | A graph may contain many edges and no vertices |
C. | A graph may contain no edges and no vertices |
D. | A graph may contain no vertices and many edges |
Answer» B. A graph may contain many edges and no vertices |
162. | For a given graph G having v vertices and e edges which is connected and has no cycles, which of the following statements is true? |
A. | v=e |
B. | v = e+1 |
C. | v + 1 = e |
D. | v = e-1 |
Answer» B. v = e+1 |
163. | For which of the following combinations of the degrees of vertices would the connected graph be eulerian? |
A. | 1,2,3 |
B. | 2,3,4 |
C. | 2,4,5 |
D. | 1,3,5 |
Answer» A. 1,2,3 |
164. | A graph with all vertices having equal degree is known as a |
A. | Multi Graph |
B. | Regular Graph |
C. | Simple Graph |
D. | Complete Graph |
Answer» B. Regular Graph |
165. | Which of the following ways can be used to represent a graph? |
A. | Adjacency List and Adjacency Matrix |
B. | Incidence Matrix |
C. | Adjacency List, Adjacency Matrix as well as Incidence Matrix |
D. | No way to represent |
Answer» C. Adjacency List, Adjacency Matrix as well as Incidence Matrix |
166. | The number of possible undirected graphs which may have self loops but no multiple edges and have n vertices is |
A. | 2((n*(n-1))/2) |
B. | 2((n*(n+1))/2) |
C. | 2((n-1)*(n-1))/2) |
D. | 2((n*n)/2) |
Answer» D. 2((n*n)/2) |
167. | Given a plane graph, G having 2 connected component, having 6 vertices, 7 edges and 4 regions. What will be the number of connected components? |
A. | 1 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» B. 2 |
168. | Number of vertices with odd degrees in a graph having a eulerian walk is |
A. | 0 |
B. | Can’t be predicted |
C. | 2 |
D. | either 0 or 2 |
Answer» D. either 0 or 2 |
169. | How many of the following statements are correct? |
A. | All cyclic graphs are complete graphs. |
B. | All complete graphs are cyclic graphs. |
C. | All paths are bipartite. |
D. | All cyclic graphs are bipartite. |
Answer» B. All complete graphs are cyclic graphs. |
170. | What is the number of vertices of degree 2 in a path graph having n vertices,here n>2. |
A. | n-2 |
B. | n |
C. | 2 |
D. | 0 |
Answer» A. n-2 |
171. | What would the time complexity to check if an undirected graph with V vertices and E edges is Bipartite or not given its adjacency matrix? |
A. | O(E*E) |
B. | O(V*V) |
C. | O(E) |
D. | O(V) |
Answer» B. O(V*V) |
172. | With V(greater than 1) vertices, how many edges at most can a Directed Acyclic Graph possess? |
A. | (V*(V-1))/2 |
B. | (V*(V+1))/2 |
C. | (V+1)C2 |
D. | (V-1)C2 |
Answer» A. (V*(V-1))/2 |
173. | The topological sorting of any DAG can be done in time. |
A. | cubic |
B. | quadratic |
C. | linear |
D. | logarithmic |
Answer» C. linear |
174. | If there are more than 1 topological sorting of a DAG is possible, which of the following is true. |
A. | Many Hamiltonian paths are possible |
B. | No Hamiltonian path is possible |
C. | Exactly 1 Hamiltonian path is possible |
D. | Given information is insufficient to comment anything |
Answer» B. No Hamiltonian path is possible |
176. | What is the value of the sum of the minimum in-degree and maximum out-degree of an Directed Acyclic Graph? | |
A. | Depends on a Graph | |
B. | Will always be zero | |
C. | Will always be greater than zero | |
D. | May be zero or greater than zero | |
Answer» B. Will always be zero | ||
Chapter: Searching, Sorting and Hashing Techniques
177. | Where is linear searching used? |
A. | When the list has only a few elements |
B. | When performing a single search in an unordered list |
C. | Used all the time |
D. | When the list has only a few elements and When performing a single search in an unordered list |
Answer» D. When the list has only a few elements and When performing a single search in an unordered list |
178. | What is the best case for linear search? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(1) |
Answer» D. O(1) |
179. | What is the worst case for linear search? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(1) |
Answer» C. O(n) |
180. | What is the best case and worst case complexity of ordered linear search? |
A. | O(nlogn), O(logn) |
B. | O(logn), O(nlogn) |
C. | O(n), O(1) |
D. | O(1), O(n) |
Answer» D. O(1), O(n) |
181. | Which of the following is a disadvantage of linear search? |
A. | Requires more space |
B. | Greater time complexities compared to other searching algorithms |
C. | Not easy to understand |
D. | Not easy to implement |
Answer» B. Greater time complexities compared to other searching algorithms |
182. | What is the advantage of recursive approach than an iterative approach? |
A. | Consumes less memory |
B. | Less code and easy to implement |
C. | Consumes more memory |
D. | More code has to be written |
Answer» B. Less code and easy to implement |
183. | Given an input arr = {2,5,7,99,899}; key = 899; What is the level of recursion? |
A. | 5 |
B. | 2 |
C. | 3 |
D. | 4 |
Answer» C. 3 |
184. | Given an array arr = {45,77,89,90,94,99,100} and key = 99; what are the mid values(corresponding array elements) in the first and second levels of recursion? |
A. | 90 and 99 |
B. | 90 and 94 |
C. | 89 and 99 |
D. | 89 and 94 |
Answer» A. 90 and 99 |
185. | What is the worst case complexity of binary search using recursion? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» B. O(logn) |
186. | What is the average case time complexity of binary search using recursion? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» B. O(logn) |
187. | Which of the following is not an application of binary search? |
A. | To find the lower/upper bound in an ordered sequence |
B. | Union of intervals |
C. | Debugging |
D. | To search in unordered list |
Answer» D. To search in unordered list |
188. | Binary Search can be categorized into which of the following? |
A. | Brute Force technique |
B. | Divide and conquer |
C. | Greedy algorithm |
D. | Dynamic programming |
Answer» B. Divide and conquer |
189. | Given an array arr = {5,6,77,88,99} and key = 88; How many iterations are done until the element is found? |
A. | 1 |
B. | 3 |
C. | 4 |
D. | 2 |
Answer» D. 2 |
190. | Given an array arr = {45,77,89,90,94,99,100} and key = 100; What are the mid values(corresponding array elements) generated in the first and second iterations? |
A. | 90 and 99 |
B. | 90 and 100 |
C. | 89 and 94 |
D. | 94 and 99 |
Answer» A. 90 and 99 |
191. | What is the time complexity of binary search with iteration? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» B. O(logn) |
192. | What is an external sorting algorithm? |
A. | Algorithm that uses tape or disk during the sort |
B. | Algorithm that uses main memory during the sort |
C. | Algorithm that involves swapping |
D. | Algorithm that are considered ‘in place’ |
Answer» A. Algorithm that uses tape or disk during the sort |
193. | What is an internal sorting algorithm? |
A. | Algorithm that uses tape or disk during the sort |
B. | Algorithm that uses main memory during the sort |
C. | Algorithm that involves swapping |
D. | Algorithm that are considered ‘in place’ |
Answer» B. Algorithm that uses main memory during the sort |
194. | What is the worst case complexity of bubble sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
195. | What is the average case complexity of bubble sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
196. | Which of the following is not an advantage of optimised bubble sort over other sorting techniques in case of sorted elements? |
A. | It is faster |
B. | Consumes less memory |
C. | Detects whether the input is already sorted |
D. | Consumes less time |
Answer» C. Detects whether the input is already sorted |
197. | The given array is arr = {1, 2, 4, 3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array? |
A. | 4 |
B. | 2 |
C. | 1 |
D. | 0 |
Answer» A. 4 |
198. | What is the best case efficiency of bubble sort in the improvised version? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» C. O(n) |
199. | The given array is arr = {1,2,4,3}. Bubble sort is used to sort the array elements. How many iterations will be done to sort the array with improvised version? |
A. | 4 |
B. | 2 |
C. | 1 |
D. | 0 |
Answer» B. 2 |
201. | In the following scenarios, when will you use selection sort? | |
A. | The input is already sorted | |
B. | A large file has to be sorted | |
C. | Large values need to be sorted with small keys | |
D. | Small values need to be sorted with large keys | |
Answer» C. Large values need to be sorted with small keys | ||
202. | What is the worst case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
203. | What is the advantage of selection sort over other sorting techniques? |
A. | It requires no additional storage space |
B. | It is scalable |
C. | It works best for inputs which are already sorted |
D. | It is faster than any other sorting technique |
Answer» A. It requires no additional storage space |
204. | What is the average case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
205. | What is the disadvantage of selection sort? |
A. | It requires auxiliary memory |
B. | It is not scalable |
C. | It can be used for small keys8 |
D. | It takes linear time to sort the elements |
Answer» B. It is not scalable |
206. | The given array is arr = {3,4,5,2,1}. The number of iterations in bubble sort and selection sort respectively are, |
A. | 5 and 4 |
B. | 4 and 5 |
C. | 2 and 4 |
D. | 2 and 5 |
Answer» A. 5 and 4 |
207. | The given array is arr = {1,2,3,4,5}. (bubble sort is implemented with a flag variable)The number of iterations in selection sort and bubble sort respectively are, |
A. | 5 and 4 |
B. | 1 and 4 |
C. | 0 and 4 |
D. | 4 and 1 |
Answer» D. 4 and 1 |
208. | What is the best case complexity of selection sort? |
A. | O(nlogn) |
B. | O(logn) |
C. | O(n) |
D. | O(n2) |
Answer» D. O(n2) |
209. | Shell sort is also known as |
A. | diminishing decrement sort |
B. | diminishing increment sort |
C. | partition exchange sort |
D. | diminishing insertion sort |
Answer» B. diminishing increment sort |
210. | Statement 1: Shell sort is a stable sorting algorithm. Statement 2: Shell sort is an in-place sorting algorithm. |
A. | Both statements are true |
B. | Statement 2 is true but statement 1 is false |
C. | Statement 2 is false but statement 1 is true |
D. | none |
Answer» B. Statement 2 is true but statement 1 is false |
211. | Shell sort is applied on the elements 27 59 49 37 15 90 81 39 and the chosen decreasing sequence of increments is (5,3,1). The result after the first iteration will be |
A. | 27 59 49 37 15 90 81 39 |
B. | 27 59 37 49 15 90 81 39 |
C. | 27 59 39 37 15 90 81 49 |
D. | 15 59 49 37 27 90 81 39 |
Answer» C. 27 59 39 37 15 90 81 49 |
212. | Shell sort is an improvement on |
A. | insertion sort |
B. | selection sort |
C. | binary tree sort |
D. | quick sort |
Answer» A. insertion sort |
213. | An array that is first 7-sorted, then 5-sorted becomes |
A. | 7-ordered |
B. | 5-ordered |
C. | both 2-ordered and 5-ordered |
D. | both 7-ordered and 5-ordered |
Answer» D. both 7-ordered and 5-ordered |
214. | If Hibbard increments (h1= 1, h2= 3, h3= 7, …, hk = 2k–1) are used in a Shell sortimplementation, then the best case time complexity will be |
A. | O(nlogn) |
B. | O(n) |
C. | O(n2) |
D. | O(logn) |
Answer» A. O(nlogn) |
215. | Records R1, R2, R3,.. RN with keys K1, K2, K3,.. KN are said to be h-ordered, if |
A. | Ki <= Ki+h for 1<= i*h <= N |
B. | Kh <= Ki+h for 1<= i <= N |
C. | Ki <= Kh for 1<= i <= h |
D. | Ki <= Ki+h for 1<= i <= N-h |
Answer» D. Ki <= Ki+h for 1<= i <= N-h |
216. | Which of the following is true? |
A. | Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements |
B. | Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap like in Comb sort |
C. | Comb sort’s passes completely sort the elements before going on to the next-smallest gap like in Shell sort |
D. | Shell sort’s passes do not completely sort the elements before going on to the next-smallest gap while Comb sort’s passes completely sort the elements |
Answer» A. Shell sort’s passes completely sort the elements before going on to the next-smallest gap while Comb sort’s passes do not completely sort the elements |
217. | Which of the following is the distribution sort? |
A. | Heap sort |
B. | Smooth sort |
C. | Quick sort |
D. | LSD radix sort |
Answer» D. LSD radix sort |
218. | What is the worst case time complexity of LSD radix sort? |
A. | O(nlogn) |
B. | O(wn) |
C. | O(n) |
D. | O(n + w) |
Answer» B. O(wn) |
219. | LSD radix sort requires passes to sort N elements. |
A. | (w/logR) |
B. | N(w/logR) |
C. | (w/log(RN)) |
D. | (wN/log(N)) |
Answer» A. (w/logR) |
220. | Which of the following is false? |
A. | LSD radix sort is an integer sorting algorithm |
B. | LSD radix sort is a comparison sorting algorithm |
C. | LSD radix sort is a distribution sort |
D. | LSD radix sort uses bucket sort |
Answer» B. LSD radix sort is a comparison sorting algorithm |
221. | Which of the following sorting algorithm is stable? |
A. | Heap sort |
B. | Selection sort |
C. | In-place MSD radix sort |
D. | LSD radix sort |
Answer» D. LSD radix sort |
222. | Which of the following should be used to sort a huge database on a fixed-length key field? |
A. | Insertion sort |
B. | Merge sort |
C. | LSD radix sort |
D. | Quick sort |
Answer» C. LSD radix sort |
223. | Which of the following is a combination of LSD and MSD radix sorts? |
A. | Forward radix sort |
B. | 3-way radix quick sort |
C. | Trie base radix sort |
D. | Flash sort |
Answer» A. Forward radix sort |
224. | Which of the following is true for the LSD radix sort? |
A. | works best for variable length strings |
B. | accesses memory randomly |
C. | inner loop has less instructions |
D. | sorts the keys in left-to-right order |
Answer» B. accesses memory randomly |
226. | Which hash function satisfies the condition of simple uniform hashing? | |
A. | h(k) = lowerbound(km) | |
B. | h(k)= upperbound(mk) | |
C. | h(k)= lowerbound(k) | |
D. | h(k)= upperbound(k) | |
Answer» A. h(k) = lowerbound(km) | ||
227. | What is the hash function used in the division method? |
A. | h(k) = k/m |
B. | h(k) = k mod m |
C. | h(k) = m/k |
D. | h(k) = m mod k |
Answer» B. h(k) = k mod m |
228. | What can be the value of m in the division method? |
A. | Any prime number |
B. | Any even number |
C. | 2p – 1 |
D. | 2p |
Answer» A. Any prime number |
229. | Which scheme provides good performance? |
A. | open addressing |
B. | universal hashing |
C. | hashing by division |
D. | hashing by multiplication |
Answer» B. universal hashing |
230. | Using division method, in a given hash table of size 157, the key of value 172 be placed at position |
A. | 19 |
B. | 72 |
C. | 15 |
D. | 17 |
Answer» C. 15 |
231. | How many steps are involved in creating a hash function using a multiplication method? |
A. | 1 |
B. | 4 |
C. | 3 |
D. | 2 |
Answer» D. 2 |
232. | What is the hash function used in multiplication method? |
A. | h(k) = floor( m(kA mod 1)) |
B. | h(k) = ceil( m(kA mod 1)) |
C. | h(k) = floor(kA mod m) |
D. | h(k) = ceil( kA mod m) |
Answer» A. h(k) = floor( m(kA mod 1)) |
233. | What is the advantage of the multiplication method? |
A. | only 2 steps are involved |
B. | using constant |
C. | value of m not critical |
D. | simple multiplication |
Answer» C. value of m not critical |
234. | What is the table size when the value of p is 7 in multiplication method of creating hash functions? |
A. | 14 |
B. | 128 |
C. | 49 |
D. | 127 |
Answer» B. 128 |
235. | What is the average retrieval time when n keys hash to the same slot? |
A. | Theta(n) |
B. | Theta(n2) |
C. | Theta(nlog n) |
D. | Big-Oh(n2) |
Answer» A. Theta(n) |
More MCQs
236. | A ___________refers to a single unit of values. |
A. | data value. |
B. | attribute value. |
C. | data item. |
D. | elementary. |
Answer» C. data item. |
237. | Data items that are divided into subitems are called ___________. |
A. | single items. |
B. | group items. |
C. | elementary items. |
D. | entity items. |
Answer» B. group items. |
238. | Which of these best describes an array? |
A. | A data structure that shows a hierarchical behavior |
B. | Container of objects of similar types |
C. | Container of objects of mixed types |
D. | All of the mentioned |
Answer» B. Container of objects of similar types |
239. | In _______________all the records contain the same data items with the same amount of space. |
A. | variable-length records. |
B. | fixed-length records. |
C. | subscripted variable. |
D. | superscripted variable. |
Answer» B. fixed-length records. |
240. | The logical or mathematical model of a particular organization of data is called a _______________. |
A. | data structure. |
B. | algorithms. |
C. | structure. |
D. | logic structure. |
Answer» A. data structure. |
241. | Arrays are best data structures for _____________________________. |
A. | relatively permanent collections of data. |
B. | the size of the structure and the data in the structure are constantly changing. |
C. | both of above situation. |
D. | None of the above. |
Answer» A. relatively permanent collections of data. |
242. | How do the nested calls of the function get managed? |
A. | Through Queues. |
B. | Through Stacks. |
C. | Through Trees. |
D. | Through Graphs. |
Answer» B. Through Stacks. |
243. | __________is combining the records in two different sorted files in to a single sorted file. |
A. | Sorting. |
B. | Searching. |
C. | Listing. |
D. | Merging. |
Answer» D. Merging. |
244. | In linear search algorithm the Worst case occurs when ____________. |
A. | The item is somewhere in the middle of the array. |
B. | The item is not in the array at all. |
C. | The item is the last element in the array. |
D. | The item is the last element in the array or is not there at all. |
Answer» D. The item is the last element in the array or is not there at all. |
245. | The complexity of Binary search algorithm is ____________. |
A. | O(n). |
B. | O(log n ). |
C. | O(n2). |
D. | O(n log n). |
Answer» B. O(log n ). |
246. | The complexity of Bubble sort algorithm is _________. |
A. | O(n). |
B. | O(log n). |
C. | O(n2). |
D. | O(n log n). |
Answer» C. O(n2). |
247. | Inorder traversal of binary search tree will produce _______________. |
A. | unsorted list. |
B. | sorted list. |
C. | reverse of input. |
D. | none of these. |
Answer» B. sorted list. |
248. | Sub algorithms fall into two basic categories: function sub algorithms and ____________ sub algorithms. |
A. | procedure. |
B. | argument. |
C. | processor. |
D. | methods. |
Answer» A. procedure. |
249. | Two main measures for the efficiency of an algorithm are____________. |
A. | Processor and memory. |
B. | Complexity and capacity. |
C. | Time and space. |
D. | Data and space. |
Answer» C. Time and space. |
251. | Which of the following data structure is linear data structure? |
A. | Tree. |
B. | Graph. |
C. | Array. |
D. | Linked list. |
Answer» C. Array. |
252. | Which of the following is an example of dynamic programming approach? |
A. | Fibonacci Series |
B. | Tower of Hanoi |
C. | Dijkstra Shortest Path |
D. | All of the above |
Answer» D. All of the above |
253. | The memory address of the first element of an array is called_________. |
A. | floor address. |
B. | foundation address. |
C. | first address. |
D. | base address. |
Answer» D. base address. |
254. | Which data structure allows deleting data elements from front and inserting at rear? |
A. | Stacks. |
B. | Queues. |
C. | Dequeues. |
D. | Binary search tree. |
Answer» B. Queues. |
255. | Binary search algorithm cannot be applied to________ concept. |
A. | unsorted linked list. |
B. | sorted binary trees. |
C. | sorted linear array. |
D. | pointer array. |
Answer» A. unsorted linked list. |
256. | Graph traversal is different from a tree traversal, because |
A. | trees are not connected. |
B. | graphs may have loops. |
C. | trees have root. |
D. | None is true as tree is a subset of graph. |
Answer» C. trees have root. |
257. | Linked lists are suitable for which of the following problems? |
A. | Insertion sort |
B. | Binary search |
C. | Radix sort |
D. | dequeue. |
Answer» B. Binary search |
258. | Identify the data structure which allows deletions at both ends of the list but insertion at only one end___________. |
A. | Input-restricted dequeue. |
B. | Output-restricted dequeue. |
C. | Priority queues. |
D. | Data structure. |
Answer» A. Input-restricted dequeue. |
259. | Which of the following data structure is non-linear type? |
A. | Strings. |
B. | Lists. |
C. | Stacks. |
D. | Hierarchical. |
Answer» D. Hierarchical. |
260. | To represent hierarchical relationship between elements, which data structure is suitable? |
A. | Dequeue. |
B. | Priority. |
C. | Tree. |
D. | Binary tree. |
Answer» C. Tree. |
261. | When does the ArrayIndexOutOfBoundsException occur? |
A. | Compile-time |
B. | Run-time |
C. | Not an error |
D. | None of the mentioned |
Answer» B. Run-time |
262. | The depth of a complete binary tree is given by__________. |
A. | Dn = n log2n. |
B. | Dn = n log2n+1. |
C. | Dn = log2n. |
D. | Dn = log2n+1. |
Answer» D. Dn = log2n+1. |
263. | When converting binary tree into extended binary tree, all the original nodes in binary tree are___________. |
A. | internal nodes on extended tree. |
B. | external nodes on extended tree. |
C. | vanished on extended tree. |
D. | post order traversal. |
Answer» A. internal nodes on extended tree. |
264. | Which of the following conditions checks available free space in avail list? |
A. | Avail=Top |
B. | Null=Avail |
C. | Avail=Null |
D. | Avail=Max stack |
Answer» C. Avail=Null |
265. | Which of the following sorting algorithm is of divide-and-conquer type? |
A. | Bubble sort. |
B. | Insertion sort. |
C. | Quick sort. |
D. | Algorithm. |
Answer» C. Quick sort. |
266. | STACK is also called as ______________. |
A. | FIFO |
B. | LIFO |
C. | FOLI |
D. | FOFI |
Answer» B. LIFO |
267. | Collection of related data items is called _______. |
A. | files |
B. | fields |
C. | attributes. |
D. | records. |
Answer» D. records. |
268. | Breadth First search is used in____________. |
A. | binary tree. |
B. | stacks. |
C. | graphs. |
D. | both a and c. |
Answer» C. graphs. |
269. | A variable whose size is determined at compile time and cannot be changed at run time is_________. |
A. | static variable. |
B. | dynamic variable. |
C. | not a variable. |
D. | data variable. |
Answer» A. static variable. |
270. | Process of inserting an element in stack is called ____________. |
A. | Create |
B. | Push |
C. | Evaluation |
D. | Pop |
Answer» B. Push |
271. | Length of linear array can be found by using the formula_________ |
A. | UB-LB+1 |
B. | LB+UB |
C. | LB-UB |
D. | LB-UB+1 |
Answer» A. UB-LB+1 |
272. | The average number of key comparisons done in a successful sequential search in a list of length n is___________. |
A. | log n |
B. | n-1/2. |
C. | n/2. |
D. | n+1/2. |
Answer» D. n+1/2. |
273. | A technique for direct search is _______________. |
A. | Binary Search |
B. | Linear Search |
C. | Tree Search |
D. | Hashing |
Answer» D. Hashing |
274. | Base address is the address of __________. |
A. | first element |
B. | middle element |
C. | last element |
D. | pivot element |
Answer» A. first element |
276. | ___________are used to facilitate the processing of information in an array. |
A. | Pointers. |
B. | Memory location. |
C. | Records. |
D. | Variables. |
Answer» A. Pointers. |
277. | The comparison tree is also called as________. |
A. | decision tree. |
B. | binary tree. |
C. | sequential tree. |
D. | b+ tree. |
Answer» A. decision tree. |
278. | A linked list whose last node points back to the list node instead of containing the null pointer________. |
A. | circular list. |
B. | linked list. |
C. | circular doubly linked list. |
D. | doubly linked list. |
Answer» A. circular list. |
279. | __________________ is a header list where the last node contains the null pointer. |
A. | Circular Header linked list |
B. | Grounded Header Linked list |
C. | Linked list |
D. | Linear Array |
Answer» B. Grounded Header Linked list |
280. | Which of the following case does not exist in complexity theory |
A. | Best case |
B. | Worst case |
C. | Average case |
D. | Null case |
Answer» D. Null case |
281. | The _________ for a linked list is a pointer variable that locates the beginning of the list. |
A. | anchor. |
B. | base. |
C. | footer. |
D. | header. |
Answer» D. header. |
282. | The time factor when determining the efficiency of algorithm is measured by____________. |
A. | counting microseconds. |
B. | counting the number of key operations. |
C. | counting the number of statements. |
D. | counting the kilobytes of algorithm. |
Answer» B. counting the number of key operations. |
283. | The space factor when determining the efficiency of algorithm is measured by___________. |
A. | counting the maximum memory needed by the algorithm. |
B. | counting the minimum memory needed by the algorithm. |
C. | counting the average memory needed by the algorithm. |
D. | counting the maximum disk space needed by the algorithm. |
Answer» A. counting the maximum memory needed by the algorithm. |
284. | The Worst case occur in linear search algorithm when_____________. |
A. | item is somewhere in the middle of the array. |
B. | item is not in the array at all. |
C. | item is the last element in the array. |
D. | item is the last element in the array or is not there at all. |
Answer» D. item is the last element in the array or is not there at all. |
285. | The complexity of linear search algorithm is____________. |
A. | O(log n). |
B. | O(n). |
C. | O(n2). |
D. | O(n log n). |
Answer» B. O(n). |
286. | The time required in best case for search operation in binary tree is ____________. |
A. | O(n). |
B. | O(2n). |
C. | O(log n). |
D. | O( log 2n). |
Answer» C. O(log n). |
287. | Which of the following way follows in Post order traversal? |
A. | Root -> Left sub tree -> Right sub tree. |
B. | Root -> Right sub tree -> Left sub tree. |
C. | Left sub tree -> Root -> Right sub tree. |
D. | Left sub tree -> Right sub tree -> Root. |
Answer» D. Left sub tree -> Right sub tree -> Root. |
288. | A _________is a linked list which always contains a special node called the header node, at the beginning of the list. |
A. | Doubly Linked List. |
B. | Circular List. |
C. | Header Linked List. |
D. | None. |
Answer» C. Header Linked List. |
289. | _______________is a header list where the last node points back to the header node. |
A. | Doubly header List. |
B. | Singly header List. |
C. | Grounder Header List. |
D. | Circular Header List. |
Answer» D. Circular Header List. |
290. | The advantage of a two-way list and a circular header list is combined into a ________. |
A. | two-way circular header list. |
B. | two-way circular list. |
C. | two-way header circular list. |
D. | None. |
Answer» A. two-way circular header list. |
291. | The pointer of the last node contains a special value called_____________. |
A. | null pointer. |
B. | index pointer. |
C. | pointer link. |
D. | address pointer. |
Answer» B. index pointer. |
292. | The OS of a computer may periodically collect all the deleted space onto the free storage list. This technique is called______________. |
A. | buffering. |
B. | garbage collection. |
C. | deal location. |
D. | buffer collection. |
Answer» B. garbage collection. |
293. | Important part of any compiler is the construction and maintenances of a dictionary, this types of dictionary are called______________. |
A. | symbol table. |
B. | index table. |
C. | grammar table. |
D. | pointer table. |
Answer» A. symbol table. |
294. | The data structure required to check whether an expression contains balanced parenthesis is? |
A. | queue |
B. | stack |
C. | linked list |
D. | file |
Answer» B. stack |
295. | What are the advantages of arrays? |
A. | Easier to store elements of same data type |
B. | Used to implement other data structures like stack and queue |
C. | Convenient way to represent matrices as a 2D array |
D. | All of the mentioned |
Answer» D. All of the mentioned |
296. | The number of possible ordered trees with three nodes A,B,C is? |
A. | 16 |
B. | 12. |
C. | 10 |
D. | 6 |
Answer» B. 12. |
297. | The earliest use of__________ sorting was in conjunction with network analysis. |
A. | topological. |
B. | bubble. |
C. | radix. |
D. | heap. |
Answer» A. topological. |
298. | _________is not the operation that can be performed on Queue. |
A. | Traversal. |
B. | Insertion. |
C. | Deletion. |
D. | Retrieval. |
Answer» A. Traversal. |
299. | A tree is a finite set of_________. |
A. | loops. |
B. | domains. |
C. | functions. |
D. | nodes. |
Answer» D. nodes. |
301. | The hashing file space is divided into_______________. |
A. | nodes and roots. |
B. | roots and slots. |
C. | buckets and slots. |
D. | slots and nodes. |
Answer» C. buckets and slots. |
302. | Matrices with a relatively high proportion of zero entries are called _______ matrices. |
A. | sparse. |
B. | Null. |
C. | Zero. |
D. | worse. |
Answer» A. sparse. |
303. | The Postfix equivalent of the Prefix Notation * + ab – cd is |
A. | ab + cd – * |
B. | abcd +-* |
C. | ab+cd*- |
D. | ab+-cd* |
Answer» A. ab + cd – * |
304. | Data structure which is capable of expressing more complex relationship than that of physical adjacency is called______________. |
A. | linear data structure. |
B. | linked list. |
C. | non linear data Structure |
D. | data structure. |
Answer» C. non linear data Structure |
305. | A tree is a data structure which represents hierarchical relationship between individual _________. |
A. | data items. |
B. | fields. |
C. | nodes. |
D. | linked list. |
Answer» A. data items. |
306. | In a directed tree any node which has out degree 0 is called a terminal node or__________. |
A. | a tree. |
B. | a list. |
C. | a node. |
D. | a leaf. |
Answer» D. a leaf. |
307. | In a directed tree if the ordering of the nodes at each level is prescribed then such a tree is called_______ tree. |
A. | directed. |
B. | structure. |
C. | ordered. |
D. | degree of. |
Answer» C. ordered. |
308. | ______________ a tree means processing it in such a way that each node is visited only once. |
A. | Traversing. |
B. | Implement. |
C. | Partition. |
D. | Node. |
Answer» A. Traversing. |
309. | The length of the path is the number of_____________ on the path. |
A. | nodes. |
B. | fields. |
C. | data. |
D. | edges. |
Answer» D. edges. |
310. | The children node of same parent is called____________. |
A. | binary tree. |
B. | tree. |
C. | sibling. |
D. | list. |
Answer» C. sibling. |
311. | The situation in linked list START = NULL is called_________ |
A. | Overflow |
B. | Underflow |
C. | Zero |
D. | None of the above |
Answer» B. Underflow |
312. | A code which deals about short form of a program is called __________ code. |
A. | program. |
B. | data. |
C. | pseudo. |
D. | derived. |
Answer» C. pseudo. |
313. | Which of the application may use a stack? |
A. | Expression Evaluation |
B. | Keeping track of local variables at run time. |
C. | Syntax analyzer for a compiler |
D. | All of the above. |
Answer» A. Expression Evaluation |
314. | The queue which wraps around upon reaching the end of the array is called as____________. |
A. | circular queue. |
B. | linked queue. |
C. | doubly linked list. |
D. | representation of queue. |
Answer» A. circular queue. |
315. | A _______________ is a reference to a memory location, which is used to store data that is described in a data type. |
A. | element. |
B. | variable. |
C. | pointer. |
D. | memory. |
Answer» B. variable. |
316. | If the elements A, B, C and D are placed in a stack and are deleted one at a time, what is the order of removal? |
A. | ABCD |
B. | DCBA |
C. | DCAB |
D. | ABDC |
Answer» B. DCBA |
317. | ____________ has certain attributes or properties which may be assigned values. |
A. | field system. |
B. | record. |
C. | entity. |
D. | files. |
Answer» C. entity. |
318. | The number of interchanges required to sort 5, 1, 6, 2 4 in ascending order using Bubble Sort is ____________. |
A. | 6 |
B. | 5 |
C. | 7 |
D. | 8 |
Answer» B. 5 |
319. | Maximum degree in any vector in a graph with n vertices is ________. |
A. | n. |
B. | n-1. |
C. | n+1. |
D. | 2n+1. |
Answer» B. n-1. |
320. | If FRONT = NULL then _________. |
A. | queue full |
B. | queue empty |
C. | dequeue |
D. | priority queue |
Answer» B. queue empty |
321. | _______________ is a solution to a problem independent of programming language. |
A. | Efficient. |
B. | Linked list. |
C. | Data structure. |
D. | Algorithm. |
Answer» D. Algorithm. |
322. | ________ is the situation where data-structure is empty. |
A. | Overflow. |
B. | Underflow. |
C. | Null. |
D. | Empty. |
Answer» B. Underflow. |
323. | When elements are deleted the nodes go to_________. |
A. | registers. |
B. | free pool. |
C. | recycle bin. |
D. | gets deleted permanently. |
Answer» B. free pool. |
324. | Expression into postfix expression: (A – B) * (D / E) |
A. | ABDE – * / |
B. | – * / ABDE |
C. | A B – D E * / |
D. | * – A B / D E |
Answer» D. * – A B / D E |
326. | Quick sort uses ____ for implementation. | |
A. | recursion. | |
B. | traversal. | |
C. | heaps. | |
D. | queues. | |
Answer» A. recursion. | ||
327. | What is the worst-case time for heap sort to sort an array of n elements? |
A. | O(log n). |
B. | O(n). |
C. | O(n log n). |
D. | O(n²). |
Answer» C. O(n log n). |
328. | The __________________ denotes the greatest integer. |
A. | ceiling. |
B. | time. |
C. | space. |
D. | floor. |
Answer» A. ceiling. |
329. | A binary tree of depth “d” is an almost complete binary tree if __________. |
A. | each leaf in the tree is either at level. |
B. | for any node. |
C. | both a and b. |
D. | None. |
Answer» C. both a and b. |
330. | Program module contains its own list of variables called ____________. |
A. | global. |
B. | scope. |
C. | local. |
D. | external. |
Answer» C. local. |
331. | The number of nodes in a complete binary tree of level 5 is__________. |
A. | 15. |
B. | 20. |
C. | 63. |
D. | 31. |
Answer» D. 31. |
332. | The string with zero characters is called___________. |
A. | null string. |
B. | zero string. |
C. | one string. |
D. | empty string. |
Answer» D. empty string. |
333. | The unit equal to the number of bits needed to represent a character is called a ________. |
A. | byte. |
B. | bit. |
C. | mega bytes. |
D. | kilo bytes. |
Answer» A. byte. |
334. | The number of swapping needed to sort numbers 8,22,7,9,31,19,5,13 in ascending order using bubble sort is ? |
A. | 11 |
B. | 12 |
C. | 13 |
D. | 14 |
Answer» D. 14 |
335. | In variable length storage two dollar signs are used to signal the __________. |
A. | end of the string. |
B. | beginning of the string. |
C. | mid-level of the string. |
D. | index. |
Answer» A. end of the string. |
336. | The initial configuration of the queue is a,b,c,d (a is the front end). To get the configuration d,c,b,a one needs a minimum of ? |
A. | 2 deletions and 3 additions |
B. | 3 additions and 2 deletions |
C. | 3 deletions and 3 additions |
D. | 3 deletions and 4 additions |
Answer» C. 3 deletions and 3 additions |
337. | Each node in a singly linked lists have ______ fields |
A. | 2 |
B. | 3 |
C. | 4 |
D. | 5 |
Answer» A. 2 |
338. | Quotation marks are also called as ____________. |
A. | string delimiters. |
B. | period. |
C. | stopper. |
D. | string. |
Answer» A. string delimiters. |
339. | A string `s` consists of x, y and if x is an empty string then y is called as___________. |
A. | initial substring. |
B. | substring of s. |
C. | node of the string. |
D. | index. |
Answer» A. initial substring. |
340. | The length of the string can be listed as an additional item in _____________. |
A. | base pointer. |
B. | pointer array. |
C. | node. |
D. | record. |
Answer» B. pointer array. |
341. | Who invented Quick sort procedure? |
A. | Hoare. |
B. | Sedgewick. |
C. | Mellroy. |
D. | Coreman. |
Answer» A. Hoare. |
342. | For the heap sort, access to nodes involves simple _______________ operations. |
A. | binary. |
B. | arithmetic |
C. | algebraic |
D. | logarithmic |
Answer» B. arithmetic |
343. | The maximum number of nodes on level i of a binary tree is ___________. |
A. | 2i-1. |
B. | 3i-1. |
C. | i+1. |
D. | 2i+1. |
Answer» A. 2i-1. |
344. | The number of edges in a regular graph of degree d and n vertices is _______. |
A. | maximum of n,d. |
B. | n+d. |
C. | nd. |
D. | nd/2.C |
Answer» C. nd. |
345. | Which of the following is useful in traversing a given graph by Breath first search? |
A. | Stack. |
B. | Set. |
C. | List. |
D. | Queue. |
Answer» D. Queue. |
346. | What is an external sorting algorithm? |
A. | Algorithm that uses tape or disk during the sort |
B. | Algorithm that uses main memory during the sort |
C. | Algorithm that involves swapping |
D. | Algorithm that are considered in place |
Answer» A. Algorithm that uses tape or disk during the sort |
347. | Allocating memory for arrays during program compilation is___________. |
A. | dynamic memory allocation. |
B. | memory allocation. |
C. | static allocation. |
D. | random allocation. |
Answer» C. static allocation. |
348. | The elements of an array are allocated in spaces________. |
A. | successively. |
B. | randomly. |
C. | alternately. |
D. | on any order. |
Answer» A. successively. |
349. | Accessing and processing each array elements is called __________. |
A. | sorting. |
B. | traversing. |
C. | searching. |
D. | merging. |
Answer» B. traversing. |
351. | The sequence (1,1) (2,1) (3,1) (1,2) (2,2) (3,2) . . . .represents _________. |
A. | row major order. |
B. | column major order. |
C. | random order. |
D. | successive order. |
Answer» B. column major order. |
352. | ______ is not a technique of tree traversal. |
A. | pre-order |
B. | post-order |
C. | prefix |
D. | in-order |
Answer» C. prefix |
353. | Selection sort and quick sort both fall into the same category of sorting algorithms._________ is that category. |
A. | O(n log n) sorts. |
B. | Divide-and-conquer sorts. |
C. | Interchange sorts. |
D. | Average time is quadratic. |
Answer» C. Interchange sorts. |
354. | The possibility of two different keys k1 & k2 yielding the same hash address is called__________. |
A. | merge. |
B. | obstacle. |
C. | overlapping. |
D. | collision. |
Answer» C. overlapping. |
355. | Uniform distribution of the hash address throughout the given set L is __________. |
A. | reduce the number of collision. |
B. | increase the number of collision. |
C. | totally avoid collision. |
D. | manage address. |
Answer» A. reduce the number of collision. |
356. | An edge E is called _________ if it has identical endpoints. |
A. | multiple edges. |
B. | loops. |
C. | finite. |
D. | digraph. |
Answer» B. loops. |
357. | __________involves maintaining two tables in memory. |
A. | Arranging. |
B. | Bonding. |
C. | Combing. |
D. | Chaining. |
Answer» D. Chaining. |
358. | An _________ is a well defined list of steps for solving a problem. |
A. | Algorithm. |
B. | Program. |
C. | Procedure. |
D. | Process. |
Answer» A. Algorithm. |
359. | The data items in a record form a ________ structure which can be described by means of level numbers. |
A. | hierarchical. |
B. | procedural. |
C. | indexed. |
D. | leveled. |
Answer» A. hierarchical. |
360. | A path P of length n from a node u to a node v is defined as a sequence of _________ nodes. |
A. | n. |
B. | n+1. |
C. | n+2. |
D. | n-1. |
Answer» B. n+1. |
361. | A vertex of degree one is called __________. |
A. | padent |
B. | isolated vertex |
C. | null vertex |
D. | colored vertex |
Answer» A. padent |
362. | A connected graph T without any cycles is called _____________. |
A. | a tree graph. |
B. | free tree. |
C. | a tree. |
D. | all of the above. |
Answer» D. all of the above. |
363. | If every node u in G is adjacent to every other node v in G, A graph is said to be _______. |
A. | isolate. |
B. | complete. |
C. | finite. |
D. | Strongly connected. |
Answer» B. complete. |
364. | In a graph G if e=(u,v), then u and v are called ___________. |
A. | endpoints. |
B. | adjacent nodes. |
C. | neighbours. |
D. | all of the above. |
Answer» D. all of the above. |
365. | Which of the following is true while inserting a new node in the list? |
A. | Check there is node in the list. |
B. | Check in the free node in the pool. |
C. | There is no node. |
D. | Underflow. |
Answer» B. Check in the free node in the pool. |
366. | Which of the following data structures are indexed structures? |
A. | Linear arrays. |
B. | Linked lists. |
C. | Arrays. |
D. | First address. |
Answer» A. Linear arrays. |
367. | The efficiency of a BFS algorithm is dependent on _______. |
A. | Algorithm. |
B. | Tree. |
C. | Problem. |
D. | Graph. |
Answer» D. Graph. |
368. | The average number of key comparisons done in a successful sequential search in a list of length n is ____________. |
A. | log n. |
B. | n-1/2. |
C. | n/2. |
D. | n+1/2. |
Answer» D. n+1/2. |
369. | Divide and conquer is an important algorithm design paradigm based on _______. |
A. | multi-branched recursion. |
B. | single-branched recursion. |
C. | two-way recursion. |
D. | None. |
Answer» A. multi-branched recursion. |
370. | The correctness of a divide and conquer algorithm is usually proved by _________. |
A. | mathematical theorem. |
B. | de-Morgan `s law. |
C. | mathematical induction. |
D. | none. |
Answer» C. mathematical induction. |
371. | The ____________ is used in an elegant sorting algorithm. |
A. | Heap sort. |
B. | Quick sort. |
C. | Merge sort. |
D. | Radix sort. |
Answer» A. Heap sort. |
372. | ____________ is finding a path/tour through the graph such that every vertex is visited exactly once. |
A. | Travelling Salesman tour. |
B. | Eulerian tour. |
C. | Hamiltonian tour. |
D. | None. |
Answer» C. Hamiltonian tour. |
373. | ____________ data structure is used to implement Depth First search. |
A. | Array. |
B. | Linked list. |
C. | Queue. |
D. | Stack. |
Answer» D. Stack. |
374. | The binary tree that has n leaf nodes. The number of nodes of degree 2 in this tree is |
A. | log2N |
B. | n-1 |
C. | n |
D. | None of the above |
Answer» B. n-1 |
376. | Which of the following is two way lists? | |
A. | Grounded header list. | |
B. | Circular header list. | |
C. | Linked list with header and trailer nodes. | |
D. | List traversed in two directions. | |
Answer» D. List traversed in two directions. | ||
377. | In a linked list the _________field contains the address of next element in the list. |
A. | Link field. |
B. | Next element field. |
C. | Start field. |
D. | Info field . |
Answer» A. Link field. |
378. | A list that has no nodes is called________. |
A. | End list. |
B. | Zero list. |
C. | Null list. |
D. | Sentinel list. |
Answer» C. Null list. |
379. | The special list which consists of unused memory space is called __________. |
A. | Free space. |
B. | Empty space. |
C. | Available space. |
D. | Free storage list. |
Answer» D. Free storage list. |
380. | The efficient searching algorithm for algorithm for a sorted array is _________. |
A. | Binary search. |
B. | Linear search. |
C. | Indexed search. |
D. | Repeated search. |
Answer» A. Binary search. |
381. | To insert a new node in linked list free node will be available in ___________. |
A. | Available list. |
B. | Avail list. |
C. | Free node list. |
D. | Memory space list. |
Answer» B. Avail list. |
382. | A ______________ list is a header list where the node points back to the header node. |
A. | Circular header. |
B. | Grounded header. |
C. | Two way header. |
D. | One way header. |
Answer» A. Circular header. |
383. | How many pointers are necessarily changed for the insertion in a Linked List? |
A. | 1. |
B. | 2. |
C. | 3. |
D. | 5. |
Answer» B. 2. |
384. | An algorithm that calls itself directly or indirectly is known as ____________. |
A. | Sub algorithm. . |
B. | Recursion. |
C. | Polish notation. |
D. | Traversal algorithm. |
Answer» B. Recursion. |
Tags
Question and answers in Data Structures (DS),Data Structures (DS) multiple choice questions and answers,Data Structures (DS) Important MCQs,Solved MCQs for Data Structures (DS),Data Structures (DS) MCQs with answers PDF download