DataStrustures MCQ Sample With Answerkey
DataStrustures MCQ Sample With Answerkey
a) int javatpoint[10];
b) int javatpoint;
c) javatpoint{20};
d) array javatpoint[10];
4) Which of the following is the advantage of the array data structure3Apple Watch Series 7
8) Which one of the following is the size of int arr[9] assuming that int is of 4 bytes?
a) 9
b) 36
c) 35
d) None of the above
9) Which one of the following is the process of inserting an element in the stack?
a) Insert
b) Add
c) Push
d) None of the above
10) When the user tries to delete the element from the empty stack then the condition is said to be
a ____
a) Underflow
b) Garbage collection
c) Overflow
d) None of the above
11) If the size of the stack is 10 and we try to add the 11th element in the stack then the condition
is known as___
a) Underflow
b) Garbage collection
c) Overflow
d) None of the above
12) Which one of the following is not the application of the stack data structure
a) String reversal
b) Recursion
c) Backtracking
d) Asynchronous data transfer
13) Which data structure is mainly used for implementing the recursive algorithm?
a) Queue
b) Stack
c) Binary tree
d) Linked list
14) Which data structure is required to convert the infix to prefix notation?
a) Stack
b) Linked list
c) Binary tree
d) Queue
a) A+B*C
b) +A*BC
c) ABC+*
d) None of the above
a) A+(BC*)
b) +AB*C
c) ABC+*
d) +A*BC
17) Which of the following is not the correct statement for a stack data structure?
18) If the elements '1', '2', '3' and '4' are added in a stack, so what would be the order for the
removal?
a) 1234
b) 2134
c) 4321
d) None of the above
a) 12
b) 11
c) 5
d) 4
21) Which one of the following node is considered the top of the stack if the stack is implemented
using the linked list?
a) First node
b) Second node
c) Last node
d) None of the above
23) What is another name for the circular queue among the following options?
a) Square buffer
b) Rectangle buffer
c) Ring buffer
d) None of the above
24) If the elements '1', '2', '3' and '4' are inserted in a queue, what would be order for the removal?
a) 1234
b) 4321
c) 3241
d) None of the above
25) A list of elements in which enqueue operation takes place from one end, and dequeue
operation takes place from one end is__
a) Binary tree
b) Stack
c) Queue
d) Linked list
26) Which of the following principle does Queue use?
a) LIFO principle
b) FIFO principle
c) Linear tree
d) Ordered array
27) Which one of the following is not the type of the Queue?
a) Linear Queue
b) Circular Queue
c) Double ended Queue
d) Single ended Queue
28) Which one of the following is the overflow condition if linear queue is implemented using an
array with a size MAX_SIZE?
a) rear = front
b) rear = front+1
c) rear=MAX_SIZE -1
d) rear = MAX_SIZE
29) Which one of the following is the overflow condition if a circular queue is implemented using
array having size MAX?
a) rear= MAX-1
b) rear=MAX
c) front=(rear+1) mod max
d) None of the above
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
31) Which of the following that determines the need for the Circular Queue?
32) Which one of the following is the correct way to increment the rear end in a circular queue?
a) rear =rear+1
b) (rear+1) % max
c) (rear % max) + 1
d) None of the above
34) In the linked list implementation of queue, where will the new element be inserted?
a) 3
b) 2
c) 1
d) 4
36) Which one of the following is not the application of the Queue data structure?
37) Which of the following option is true if implementation of Queue is from the linked list?
a) In enqueue operation, new nodes are inserted from the beginning and in dequeue operation,
nodes are removed from the end.
b) In enqueue operation, new nodes are inserted from the end and in dequeue operation, nodes
are deleted from the beginning.
c) In enqueue operation, new nodes are inserted from the end and in dequeue operation, nodes
are deleted from the end.
d) Both a and b
38) The necessary condition to be checked before deletion from the Queue is__
a) Overflow
b) Underflow
c) Rear value
d) Front value
39) Which data structure is the best for implementing a priority queue?
a) Stack
b) Linked list
c) Array
d) Heap
40) Which of the following principle is used if two elements in the priority queue have the same
priority?
a) LIFO
b) FIFO
c) Linear tree
d) None of the above
41) Which of the following statement is not true regarding the priority queue?
42) A linear data structure in which insertion and deletion operations can be performed from both
the ends is___
a) Queue
b) Deque
c) Priority queue
d) Circular queue
43) In the Deque implementation using singly linked list, what would be the time complexity of
deleting an element from the rear end?
a) O(1)
b) O(n2)
c) O(n)
d) O(nlogn)
44) Which of the following data structure allows you to insert the elements from both the ends
while deletion from only one end?
a) Input-restricted queue
b) Output-restricted queue
c) Priority queue
d) None of the above
45) What would be the output after performing the following operations in a Deque?
1. Insertfront(10);
2. Insertfront(20);
3. Insertrear(30);
4. Insertrear(40);
5. Deletefront();
6. Insertfront(50);
7. Deleterear();
8. Display();
a) 10, 20, 30
b) 50, 10, 30
c) 40, 20, 30
d) None of the above
46) In a circular queue implementation using array of size 5, the array index starts with 0 where
front and rear values are 3 and 4 respectively. Determine the array index at which the insertion of
the next element will take place.
a) 5
b) 0
c) 1
d) 2
47) If circular queue is implemented using array having size MAX_SIZE in which array index
starts with 0, front points to the first element in the queue, and rear points to the last element in
the queue. Which one of the following conditions used to specify that the circular queue is
empty?
a) Front=rear= -1
b) Front=rear=0
c) Front=rear+1
d) None of the above
48) Consider the implementation of the singly linked list having the head pointer only in the
representation. Which of the following operations can be performed in O(1) time?
49) What would be the time complexity if user tries to insert the element at the end of the linked
list (head pointer is known)?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
50) Which of the following is the time complexity to search an element in the linked list?
a) O(1)
b) O(n)
c) O(logn)
d) O(nlogn)
52) Which of the following statement is not true about the doubly linked list?
53) What is the maximum number of children that a node can have in a binary tree?
a) 3
b) 1
c) 4
d) 2
54) Which one of the following techniques is not used in the Binary tree?
a) Randomized traversal
b) Preorder traversal
c) Postorder traversal
d) Inorder traversal
55) Which of the following options is not true about the Binary Search tree?
a) The value of the left child should be less than the root node
b) The value of the right child should be greater than the root node.
c) The left and right sub trees should also be a binary search tree
d) None of the above
58) Which of the following satisfies the property of the Red Black tree?
a) A tree which is a binary search tree but not strictly balanced tree.
b) A node must be either Red or Black in color and root node must be black.
c) A tree with maximum three children
d) Both a and b
59) What would be the color of newly created node while inserting a new element in a Red black
tree?
1) C
2) A
3) C
4) B
5) C
6) C
7) A
8) B
9) C
10) A
11) C
12) D
13) B
14) A
15) A
16) D
17) B
18) C
19) C
20) 2
21) A
22) D
23) C
24) A
25) C
26) B
27) D
28) C
29) C
30) A
31) A
32) B
33) D
34) C
35) B
36) D
37) D
38) B
39) D
40) B
41) C
42) B
43) C
44) B
45) B
46) B
47) A
48) B
49) B
50) B
51) C
52) C
53) D
54) A
55) D
56) A
57) D
58) D
59) D
60) C