0% found this document useful (0 votes)
120 views

Aa7b3 Data Structure Mcqs

The document contains multiple choice questions about data structures including arrays, linked lists, queues, stacks, and priority queues. It tests understanding of operations like insertion, deletion, and traversal for each data structure. It also includes questions about time complexities of different operations and suitable applications of various data structures.

Uploaded by

Mujeeb Rehman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views

Aa7b3 Data Structure Mcqs

The document contains multiple choice questions about data structures including arrays, linked lists, queues, stacks, and priority queues. It tests understanding of operations like insertion, deletion, and traversal for each data structure. It also includes questions about time complexities of different operations and suitable applications of various data structures.

Uploaded by

Mujeeb Rehman
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 80

livemcqs.

com

Data Structure MCQs


1. What will be the minimum number of jumps required to reach the end of the array arr[] =
{1,2,0,0,3,6,8,5}?

a) 1

b) 2

c) 3

d) not possible to reach the end

Answer: not possible to reach the end

2. It is not possible to find the minimum number of steps to reach the end of an array in linear time.

a) true

b) false

Answer: false

3. In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?

a) 1

b) 2

c) 3

d) 4

Answer: 4

4. It is not possible to reach the end of an array if starting element of the array is 0.

a) true

b) false

Answer: true

5. What is the minimum possible time complexity to find the number of steps to reach the end of an
array?

a) O(n)

b) O(n2)

c) O(n3/2)

d) O (1)

Answer: O(n)

6. What will be the minimum number of jumps required to reach the end of the array arr[] =
{1,3,6,3,6,8,5}?

livemcqs.com
livemcqs.com

a) 1

b) 2

c) 3

d) not possible to reach the end

Answer: 3

100+ Array and Array Operations MCQs with FREE PDF

7. Consider an implementation of unsorted singly linked list. Suppose it has its representation with a
head and tail pointer. Given the representation, which of the following operation can be
implemented in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the last node of the linked list

(A) I and II

(B) I and III

(C) I, II and III

(D) I, II and IV

Answer: I, II and III

8. Consider an implementation of unsorted singly linked list. Suppose it has its representation with a
head pointer only. Given the representation, which of the following operation can be implemented
in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the last node of the linked list

(A) I and II

(B) I and III

(C) I, II and III

(D) I, II and IV

Answer: I and III

9. Consider an implementation of unsorted doubly linked list. Suppose it has its representation with
a head pointer and tail pointer. Given the representation, which of the following operation can be
implemented in O(1) time?

livemcqs.com
livemcqs.com

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the end node of the linked list

(A) I and II

(B) I and III

(C) I, II and III

(D) I, II, III and IV

Answer: I, II, III and IV

10. Consider an implementation of unsorted doubly linked list. Suppose it has its representation with
a head pointer only. Given the representation, which of the following operation can be implemented
in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the end node of the linked list

(A) I and II

(B) I and III

(C) I, II and III

(D) I, II, III and IV

Answer: I and III

11. Consider an implementation of unsorted circular linked list. Suppose it has its representation
with a head pointer only. Given the representation, which of the following operation can be
implemented in O(1) time?

i) Insertion at the front of the linked list

ii) Insertion at the end of the linked list

iii) Deletion of the front node of the linked list

iv) Deletion of the end node of the linked list

(A) I and II

(B) I and III

(C) I, II, III and IV

(D) None

livemcqs.com
livemcqs.com

Answer: None

100+ Circular Linked List MCQ Questions and Answers

12. 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: To avoid collision in hash tables

13. After performing these set of operations, what does the final list look contain?

InsertFront(10);

InsertFront(20);

InsertRear(30);

DeleteFront();

InsertRear(40);

InsertRear(10);

DeleteRear();

InsertRear(15);

display();

a) 10 30 10 15

b) 20 30 40 15

c) 20 30 40 10

d) 10 30 40 15

Answer: 10 30 40 15

14. What is the time complexity of deleting from the rear end of the dequeue implemented with a
singly linked list?

a) O(nlogn)

b) O(logn)

c) O(n)

d) O(n2)

Answer: O(n)

100+ Questions on Double Ended Queue – Data Structure MCQs

livemcqs.com
livemcqs.com

15. What is a memory efficient double linked list?

a) Each node has only one pointer to traverse the list back and forth

b) The list has breakpoints for faster traversal

c) An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list

d) A doubly linked list that uses bitwise AND operator for storing addresses

Answer: Each node has only one pointer to traverse the list back and forth

16. What is a memory efficient double linked list?

a) Each node has only one pointer to traverse the list back and forth

b) The list has breakpoints for faster traversal

c) An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list

d) A doubly linked list that uses bitwise AND operator for storing addresses

Answer: Each node has only one pointer to traverse the list back and forth

17. How do you calculate the pointer difference in a memory efficient double linked list?

a) head xor tail

b) pointer to previous node xor pointer to next node

c) pointer to previous node – pointer to next node

d) pointer to next node – pointer to previous node

Answer: pointer to previous node xor pointer to next node

100+ Doubly Linked List Questions And Answers – Data Structure MCQs

18. 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: O(n)

19. 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: Interrupt handling

livemcqs.com
livemcqs.com

20. Which of the following is not an advantage of a 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: Easy to delete elements in any case

100+ Priority Queue Questions –Data Structure MCQs

21. A queue is a?

a) FIFO (First In First Out) list

b) LIFO (Last In First Out) list.

c) Ordered array

d) Linear tree

Answer: FIFO (First In First Out) list

22. In Breadth First Search of Graph, which of the following data structure is used?

a) Stack

b) Queue

c) Linked list

d) None

Answer: Queue

23. 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) ABCD

Answer: ABCD

24. In linked list implementation of a queue, where does a new element be inserted?

a) At the head of link list

b) At the tail of the link list

c) At the centre position in the link list

d) None

livemcqs.com
livemcqs.com

Answer: At the tail of the link list

25. In the array implementation of circular queue, which of the following operation take worst case
linear time?

a) Insertion

b) Deletion

c) To empty a queue

d) None

Answer: None

26. In linked list implementation of queue, if only front pointer is maintained, which of the following
operation take worst case linear time?

a) Insertion

b) Deletion

c) To empty a queue

d) Both a) and c)

Answer: Both a) and c)

100+ Queue Operations Data Structure MCQs and Answers

27. 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: (rear+1) % CAPACITY

28. What is the term for inserting into a full queue known as?

a) overflow

b) underflow

c) null pointer exception

d) program won’t be compiled

Answer: overflow

29. What is the time complexity of enqueue operation?

a) O(logn)

b) O(nlogn)

c) O(n)

livemcqs.com
livemcqs.com

d) O(1)

Answer: O(1)

30. 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: effective usage of memory

100+ Queue Using Array Program MCQs and Answers

31. In linked list implementation of a queue, where does a new element be inserted?

a) At the head of link list

b) At the centre position in the link list

c) At the tail of the link list

d) At any position in the linked list

Answer: At the tail of the link list

32. In linked list implementation of a queue, front and rear pointers are tracked. Which of these
pointers will change during an insertion into a NONEMPTY queue?

a) Only front pointer

b) Only rear pointer

c) Both front and rear pointer

d) No pointer will be changed

Answer: Only rear pointer

33. In linked list implementation of a queue, front and rear pointers are tracked. Which of these
pointers will change during an insertion into EMPTY queue?

a) Only front pointer

b) Only rear pointer

c) Both front and rear pointer

d) No pointer will be changed

Answer: Both front and rear pointer

34. In case of insertion into a linked queue, a node borrowed from the __________ list is inserted in
the queue.

a) AVAIL

livemcqs.com
livemcqs.com

b) FRONT

c) REAR

d) NULL

Answer: AVAIL

35. In linked list implementation of a queue, from where is the item deleted?

a) At the head of link list

b) At the centre position in the link list

c) At the tail of the link list

d) Node before the tail

Answer: At the head of link list

100+ Queue Linked List Question and Answer – Data Structure MCQs

36. Consider you have a stack whose elements in it are as follows.

5 4 3 2 << top
Where the top element is 2.
You need to get the following stack
6 5 4 3 2 << top

The operations that needed to be performed are (You can perform only push and pop):

a) Push(pop()), push(6), push(pop())

b) Push(pop()), push(6)

c) Push(pop()), push(pop()), push(6)

d) Push(6)

Answer: Push(pop()), push(6), push(pop())

37. A double-ended queue supports operations like adding and removing items from both the sides
of the queue. They support four operations like addFront (adding item to top of the queue), addRear
(adding item to the bottom of the queue), removeFront (removing item from the top of the queue)
and removeRear (removing item from the bottom of the queue). You are given only stacks to
implement this data structure. You can implement only push and pop operations. What’s the time
complexity of performing addFront and addRear? (Assume ‘m’ to be the size of the stack and ‘n’ to
be the number of elements)

a) O(m) and O(n)

b) O(1) and O(n)

c) O(n) and O(1)

d) O(n) and O(m)

Answer: O(1) and O(n)

livemcqs.com
livemcqs.com

38. Why is implementation of stack operations on queues not feasible for a large dataset (Asssume
the number of elements in the stack to be n)?

a) Because of its time complexity O(n)

b) Because of its time complexity O(log(n))

c) Extra memory is not required

d) There are no problems

Answer: Because of its time complexity O(n)

39. Consider yourself to be in a planet where the computational power of chips to be slow. You have
an array of size 10. You want to perform enqueue some element into this array. But you can perform
only push and pop operations. Push and pop operation both take 1 sec respectively. The total time
required to perform enQueue operation is?

a) 20

b) 40

c) 42

d) 43

Answer: 43

40. You have two jars, one jar which has 10 rings and the other has none. They are placed one above
the other. You want to remove the last ring in the jar. And the second jar is weak and cannot be used
to store rings for a long time.

a) Empty the first jar by removing it one by one from the first jar and placing it into the second jar

b) Empty the first jar by removing it one by one from the first jar and placing it into the second jar
and empty the second jar by placing all the rings into the first jar one by one

c) There exists no possible way to do this

d) Break the jar and remove the last one

Answer: Empty the first jar by removing it one by one from the first jar and placing it into the second
jar and empty the second jar by placing all the rings into the first jar one by one

100+ Queue using Stacks MCQs and Answers

41. 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: Either O(1) or O(n)

42. What is the time complexity to count the number of elements in the linked list?

livemcqs.com
livemcqs.com

a) O(1)

b) O(n)

c) O(logn)

d) O(n2)

Answer: O(n)

43. 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: O(1)

44. Which of these is not an application of a 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: Random Access of elements

100+ Singly Linked List MCQ Questions and Answers

45. 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: θ(n)

46. 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: O(1)

livemcqs.com
livemcqs.com

47. 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: O(n)

48. 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: O(1)

49. The concatenation of two lists can be performed in O(1) time. Which of the following variation of
the linked list can be used?

a) Singly linked list

b) Doubly linked list

c) Circular doubly linked list

d) Array implementation of list

Answer: Circular doubly linked list

100+ Singly Linked Lists Operations Questions and Answers

50. In a stack, if a user tries to remove an element from an empty stack it is called _________

a) Underflow

b) Empty collection

c) Overflow

d) Garbage Collection

Answer: Underflow

51. Pushing an element into stack already having five elements and stack size of 5, then stack
becomes ___________

a) Overflow

b) Crash

c) Underflow

livemcqs.com
livemcqs.com

d) User flow

Answer: Overflow

52. 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: There is a Sequential entry that is one by one

53. 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: Data Transfer between two asynchronous process

100+Stack Operations Questions and Answers

54. What is the time complexity of pop() operation when the stack is implemented using an array?

a) O(1)

b) O(n)

c) O(logn)

d) O(nlogn)

Answer: O(1)

55. Which of the following array position will be occupied by a new element being pushed for a stack
of size N elements (capacity of stack > N)?

a) S[N-1]

b) S[N]

c) S[1]

d) S[0]

Answer: S[N]

56. What happens when you pop from an empty stack while implementing using the Stack ADT in
Java?

a) Undefined error

b) Compiler displays a warning

livemcqs.com
livemcqs.com

c) EmptyStackException is thrown

d) NoStackException is thrown

Answer: EmptyStackException is thrown

100+Stack using Array Questions and Answers

57. What does ‘stack overflow’ refer to?

a) accessing item from an undefined stack

b) adding items to a full stack

c) removing items from an empty stack

d) index out of bounds exception

Answer: adding items to a full stack

58. Which of the following data structures can be used for parentheses matching?

a) n-ary tree

b) queue

c) priority queue

d) stack

Answer: stack

59. Minimum number of queues to implement stack is ___________

a) 3

b) 4

c) 1

d) 2

Answer: 1

100+ Stack using Linked List Questions and Answers

60. The term Push and Pop is related to

a) Queue

b) Stack

c) Both

d) None

Answer: Stack

61. In which data structure element is inserted at one end called Rear and deleted at other end
called Front.

livemcqs.com
livemcqs.com

a) Stack

b) Queue

c) Both

d) Binary Tree

Answer: Queue

62. To implement a stack using queue (with only enqueue and dequeue operations), how many
queues will you need?

a) 1

b) 2

c) 3

d) 4

Answer: 2

100+ Stack using Queues Questions and Answers

63. Which of the following statement is incorrect with respect to balancing symbols algorithm?

a) {[()]}

b) ([ )]

c) {( )}

d) { [ ] }

Answer: ([ )]

64. What should be done when an opening parentheses is read in a balancing symbols algorithm?

a) push it on to the stack

b) throw an error

c) ignore the parentheses

d) pop the stack

Answer: push it on to the stack

65. When the corresponding end bracket/braces/parentheses is not found, what happens?

a) The stack is popped

b) Ignore the parentheses

c) An error is reported

d) It is treated as an exception

Answer: An error is reported

livemcqs.com
livemcqs.com

100+ Balanced Parenthesis Question and Answer with FREE PDF

66. Which is the predefined method available in Java to convert decimal to binary numbers?

a) toBinaryInteger(int)

b) toBinaryValue(int)

c) toBinaryNumber(int)

d) toBinaryString(int)

Answer: toBinaryString(int)

67. What is the time complexity for converting decimal to binary numbers?

a) O(1)

b) O(n)

c) O(logn)

d) O(nlogn)

Answer: O(logn)

Decimal to Binary Using Stacks Question with FREE PDF

68. Which of the following is an example for a postfix expression?

a) a*b(c+d)

b) abc*+de-+

c) +ab

d) a+b-c

Answer: abc*+de-+

69. Reverse Polish Notation is the reverse of a Polish Notation.

a) True

b) False

Answer: False

70. What is the time complexity of evaluation of postfix expression algorithm?

a) O (N)

b) O (N log N)

c) O (N2)

d) O (M log N)

Answer: O (N)

71. In Postfix expressions, the operators come after the operands.

livemcqs.com
livemcqs.com

a) True

b) False

Answer: True

72. Which of these operators have the highest order of precedence?

a) ‘(‘ and ‘)’

b) ‘*’ and ‘/’

c) ‘~’ and ‘^’

d) ‘+’ and ‘-‘

Answer: ‘~’ and ‘^’

73. Which of the following is not an application of stack?

a) evaluation of postfix expression

b) conversion of infix to postfix expression

c) balancing symbols

d) line at ticket counter

Answer: line at ticket counter

74. While evaluating a postfix expression, when an operator is encountered, what is the correct
operation to be performed?

a) push it directly on to the stack

b) pop 2 operands, evaluate them and push the result on to the stack

c) pop the entire stack

d) ignore the operator

Answer: pop 2 operands, evaluate them and push the result on to the stack

75. Which of the following statement is incorrect?

a) Postfix operators use value to their right

b) Postfix operators use value to their left

c) Prefix operators use value to their right

d) In postfix expression, operands are followed by operators

Answer: Postfix operators use value to their right

76. What is the result of the given postfix expression? abc*+ where a=1, b=2, c=3.

a) 4

b) 5

livemcqs.com
livemcqs.com

c) 6

d) 7

Answer: 7

Evaluation of a Postfix Expression Question with FREE PDF

77. While evaluating a prefix expression, the string is read from?

a) left to right

b) right to left

c) center to right

d) center to left to right

Answer: right to left

78. The associativity of an exponentiation operator ^ is right side.

a) True

b) False

Answer: True

79. How many types of input characters are accepted by this algorithm?

a) one

b) two

c) three

d) four

Answer: three

80. What determines the order of evaluation of a prefix expression?

a) precedence and associativity

b) precedence only

c) associativity only

d) depends on the parser

Answer: precedence and associativity

81. Find the output of the following prefix expression.

*+2-2 1/-4 2+-5 3 1

a) 2

b) 12

c) 10

livemcqs.com
livemcqs.com

d) 4

Answer: 2

82. An error is thrown if the character ‘\n’ is pushed in to the character stack.

a) true

b) false

Answer: false

83. Using the evaluation of prefix algorithm, evaluate +-9 2 7.

a) 10

b) 4

c) 17

d) 14

Answer: 14

84. If -*+abcd = 11, find a, b, c, d using evaluation of prefix algorithm.

a) a=2, b=3, c=5, d=4

b) a=1, b=2, c=5, d=4

c) a=5, b=4, c=7,d=5

d) a=1, b=2, c=3, d=4

Answer: a=1, b=2, c=5, d=4

Evaluation of a Prefix Expression Question with FREE PDF

85. Which of the following statement is incorrect with respect to evaluation of infix expression
algorithm?

a) Operand is pushed on to the stack

b) If the precedence of operator is higher, pop two operands and evaluate

c) If the precedence of operator is lower, pop two operands and evaluate

d) The result is pushed on to the operand stack

Answer: If the precedence of operator is higher, pop two operands and evaluate

86. Evaluate the following statement using infix evaluation algorithm and choose the correct answer.
1+2*3-2

a) 3

b) 6

c) 5

d) 4

livemcqs.com
livemcqs.com

Answer: 5

87. Evaluation of infix expression is done based on precedence of operators.

a) True

b) False

Answer: True

88. Of the following choices, which operator has the lowest precedence?

a) ^

b) +

c) /

d) #

Answer: #

89. The system throws an error if parentheses are encountered in an infix expression evaluation
algorithm.

a) True

b) False

Answer: False

90. Evaluate the following and choose the correct answer.

a/b+c*d where a=4, b=2, c=2, d=1.

a) 1

b) 4

c) 5

d) 2

Answer: 4

91. Evaluate the following statement using infix evaluation algorithm and choose the correct answer.

4*2+3-5/5

a) 10

b) 11

c) 16

d) 12

Answer: 10

50+ Evaluation of an Infix Expression (Not Parenthesized) MCQs with FREE PDF

livemcqs.com
livemcqs.com

92. Which of the following is an infix expression?

a) (a+b)*(c+d)

b) ab+c*

c) +ab

d) abc+*

Answer: (a+b)*(c+d)

93. 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: O(N)

94.What is the postfix expression for the corresponding infix expression?

a+b*c+(d*e)

a) abc*+de*+

b) abc+*de*+

c) a+bc*de+*

d) abc*+(de)*+

Answer: abc*+de*+

95. From the given Expression tree, identify the correct postfix expression from the list of options.

a) ab*cd*+

b) ab*cd-+

c) abcd-*+

d) ab*+cd-

Answer: ab*cd-+

96. 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: left to right

livemcqs.com
livemcqs.com

50+ Infix to Postfix Conversion MCQs with FREE PDF

97. What would be the Prefix notation for the given equation?

A+(B*C)

a) +A*CB

b) *B+AC

c) +A*BC

d) *A+CB

Answer: +A*BC

98. What would be the Prefix notation for the given equation?

(A*B)+(C*D)

a) +*AB*CD

b) *+AB*CD

c) **AB+CD

d) +*BA*CD

Answer: **AB+CD

99. What would be the Prefix notation for the given equation?

A+B*C^D

a) +A*B^CD

b) +A^B*CD

c) *A+B^CD

d) ^A*B+CD

Answer: +A*B^CD

50+ Infix to Prefix Conversion MCQs with FREE PDF

100. What is the value of the postfix expression 2 3 + 4 5 6 – – *

a) 19

b) 21

c) -4

d) 25

Answer: 25

101. The prefix expression of the postfix expression AB+CD-* is __________

a) (A+B)*(C-D)

livemcqs.com
livemcqs.com

b) +AB*-CD

c) A+*BCD-

d) *+AB-CD

Answer: *+AB-CD

102. The result of the postfix expression 5 3 * 9 + 6 / 8 4 / + is _____________

a) 8

b) 6

c) 10

d) 9

Answer: 6

50+ Postfix to Infix Conversion MCQs with FREE PDF

103. What would be the solution to the given prefix notation?

+9*3/84

a) 14

b) 15

c) 18

d) 12

Answer: 15

104. What would be the solution to the given prefix notation?

–+12*3/62

a) 6

b) -6

c) 3

d) -3

Answer: -6

105. What would be the solution to the given prefix notation?

–*15/*/6362

a) 1

b) 0

c) -1

d) -2

livemcqs.com
livemcqs.com

Answer: -1

50+ Prefix to Infix Conversion MCQs with FREE PDF

106. What is the time complexity of reversing a word using stack algorithm?

a) O (N log N)

b) O (N2)

c) O (N)

d) O (M log N)

Answer: O (N)

107. What will be the word obtained if the word “abbcabb” is reversed using a stack?

a) bbabbca

b) abbcabb

c) bbacbba

d) bbacabb

Answer: bbacbba

108. How many stacks are required for reversing a word algorithm?

a) one

b) two

c) three

d) four

Answer: one

50+ Reverse a Word using Stack MCQs with FREE PDF

109. The optimal data structure used to solve Tower of Hanoi is _________

a) Tree

b) Heap

c) Priority queue

d) Stack

Answer: Stack

110. Which among the following is not a palindrome?

a) Madam

b) Dad

c) Malayalam

livemcqs.com
livemcqs.com

d) Maadam

Answer: Maadam

111. Which data structure can be used to test a palindrome?

a) Tree

b) Heap

c) Stack

d) Priority queue

Answer: Stack

50+ Towers of Hanoi MCQs with FREE PDF

25-10-2021

112. Which of the following bitwise operations will you use to set a particular bit to 0?

a) OR

b) AND

c) XOR

d) NAND

Answer: AND

113. Which of the following bitwise operations will you use to toggle a particular bit?

a) OR

b) AND

c) XOR

d) NOT

Answer: XOR

114. Which of the following is not an advantage of bit array?

a) Exploit bit level parallelism

b) Maximal use of data cache

c) Can be stored and manipulated in the register set for long periods of time

d) Accessing Individual Elements is easy

Answer: Accessing Individual Elements is easy

115. Which of the following is not a disadvantage of bit array?

a) Without compression, they might become sparse

b) Accessing individual bits is expensive

livemcqs.com
livemcqs.com

c) Compressing bit array to byte/word array, the machine also has to support byte/word addressing

d) Storing and Manipulating in the register set for long periods of time

Answer: Storing and Manipulating in the register set for long periods of time

50+ Bit Array MCQs and answer with FREE PDF

116. What is a dynamic array?

a) A variable size data structure

b) An array which is created at runtime

c) The memory to the array is allocated at runtime

d) An array which is reallocated everytime whenever new elements have to be added

Answer: A variable size data structure

117. What is meant by physical size in a dynamic array?

a) The size allocated to elements

b) The size extended to add new elements

c) The size of the underlying array at the back-end

d) The size visible to users

Answer: The size of the underlying array at the back-end

118. The number of items used by the dynamic array contents is its __________

a) Physical size

b) Capacity

c) Logical size

d) Random size

Answer: Logical size

119. How will you implement dynamic arrays in Java?

a) Set

b) Map

c) HashMap

d) List

Answer: List

120. Which of the following is the correct syntax to declare an ArrayList in Java?

a) ArrayList al = new ArrayList();

b) ArrayList al = new ArrayList[];

livemcqs.com
livemcqs.com

c) ArrayList al() = new ArrayList();

d) ArrayList al[] = new ArrayList[];

Answer: ArrayList al = new ArrayList();

50+ Dynamic Array MCQs with FREE PDF

121. What are parallel arrays?

a) Arrays of the same size

b) Arrays allocated one after the other

c) Arrays of the same number of elements

d) Arrays allocated dynamically

Answer: Arrays of the same number of elements

122. Which of the following is a disadvantage of parallel array over the traditional arrays?

a) When a language does not support records, parallel arrays can be used

b) Increased locality of reference

c) Ideal cache behaviour

d) Insertion and Deletion becomes tedious

Answer: Insertion and Deletion becomes tedious

123. Which of the following is an advantage of parallel arrays?

a) Poor locality of reference for non-sequential access

b) Very little direct language support

c) Expensive to shrink or grow

d) Increased Locality of Reference

Answer: Increased Locality of Reference

124. To search for an element in a sorted array, which searching technique can be used?

a) Linear Search

b) Jump Search

c) Binary Search

d) Fibonacci Search

Answer: Binary Search

125. Which of the following is not an application of sorted array?

a) Commercial computing

b) Priority Scheduling

livemcqs.com
livemcqs.com

c) Discrete Mathematics

d) Hash Tables

Answer: Hash Tables

126. What is the worst case time complexity of inserting an element into the sorted array?

a) O(nlogn)

b) O(logn)

c) O(n)

d) O(n2)

Answer: O(n)

50+ Parallel Array MCQs with FREE PDF

127. What is sparsity of a matrix?

a) The fraction of zero elements over the total number of elements

b) The fraction of non-zero elements over the total number of elements

c) The fraction of total number of elements over the zero elements

d) The fraction of total number of elements over the non-zero elements

Answer: The fraction of zero elements over the total number of elements

128. Which of the following is the disadvantage of sparse matrices over normal matrices?

a) Size

b) Speed

c) Easily compressible

d) Algorithm complexity

Answer: Speed

50+ Sparse Array MCQs with FREE PDF

129. LCP array and ______ is used to construct suffix tree.

a) Hash tree

b) Hash trie

c) Suffix array

d) Balanced tree

Answer: Suffix array

130. What is the time required to locate the occurrences of a pattern P of length m in a string of
length n using suffix array?

livemcqs.com
livemcqs.com

a) O(nm)

b) O(n2)

c) O(mnlogn)

d) O(mlogn)

Answer: O(mlogn)

131. If comparison based sorting algorithm is used construct the suffix array, then what will be time
required to construct the suffix array?

a) O(nlogn)

b) O(n2)

c) O(n2logn)

d) O(n2) + O(logn)

Answer: O(n2logn)

132. Which of the following is false?

a) Suffix array is always sorted

b) Suffix array is used in string matching problems

c) Suffix array is always unsorted

d) Suffix array contains all the suffixes of the given string

Answer: Suffix array is always unsorted

133. Suffix array of the string “statistics” is ____________

a) 2 8 7 4 9 0 5 1 6 3

b) 2 7 4 9 8 0 5 1 6 3

c) 2 4 9 0 5 7 8 1 6 3

d) 2 8 7 0 5 1 6 9 4 3

Answer: 2 8 7 4 9 0 5 1 6 3

50+ Suffix Array MCQs with FREE PDF

134. Which of the following don’t use matrices?

a) In solving linear equations

b) Image processing

c) Graph theory

d) Sorting numbers

Answer: Sorting numbers

livemcqs.com
livemcqs.com

135. What is the order of a matrix?

a) number of rows X number of columns

b) number of columns X number of rows

c) number of rows X number of rows

d) number of columns X number of columns

Answer: number of rows X number of columns

136. Which of the following property does not hold for matrix multiplication?

a) Associative

b) Distributive

c) Commutative

d) Additive Inverse

Answer: Commutative

137. How do you allocate a matrix using a single pointer in C?(r and c are the number of rows and
columns respectively)

a) int *arr = malloc(r * c * sizeof(int));

b) int *arr = (int *)malloc(r * c * sizeof(int));

c) int *arr = (int *)malloc(r + c * sizeof(int));

d) int *arr = (int *)malloc(r * c * sizeof(arr));

Answer: int *arr = (int *)malloc(r * c * sizeof(int));

50+ Matrix MCQs with FREE PDF

138. In what way the Symmetry Sparse Matrix can be stored efficiently?

a) Heap

b) Binary tree

c) Hash table

d) Adjacency List

Answer: Binary tree

139. The matrix contains m rows and n columns. The matrix is called Sparse Matrix if ________

a) Total number of Zero elements > (m*n)/2

b) Total number of Zero elements = m + n

c) Total number of Zero elements = m/n

d) Total number of Zero elements = m-n

livemcqs.com
livemcqs.com

Answer: Total number of Zero elements > (m*n)/2

140. Which of the following is not the method to represent Sparse Matrix?

a) Dictionary of Keys

b) Linked List

c) Array

d) Heap

Answer: Heap

141. Which matrix has most of the elements (not all) as Zero?

a) Identity Matrix

b) Unit Matrix

c) Sparse Matrix

d) Zero Matrix

Answer: Sparse Matrix

50+ Sparse Matrix MCQs with FREE PDF

142. What is the time complexity of the code that uses self balancing BST for determining the
number of inversions in an array?

a) O(n2)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(n log n)

143. What is the space complexity of the code that uses merge sort for determining the number of
inversions in an array?

a) O(n)

b) O(log n)

c) O(1)

d) O(n log n)

Answer: O(n)

144. Under what condition the number of inversions in an array are maximum?

a) when the array is sorted

b) when the array is reverse sorted

c) when the array is half sorted

livemcqs.com
livemcqs.com

d) depends on the given array

Answer: when the array is reverse sorted

145. Under what condition the number of inversions in an array are minimum?

a) when the array is sorted

b) when the array is reverse sorted

c) when the array is half sorted

d) depends on the given array

Answer: when the array is sorted

146. How many inversions are there in the array arr = {1,5,4,2,3}?

a) 0

b) 3

c) 4

d) 5

Answer: 5

50+ Count Inversion MCQs with FREE PDF

147. Which of the following is the predefined function for array reversal in C++?

a) rotate()

b) arr_rotate()

c) array_rotate()

d) rot()

Answer: rotate()

148. How many arguments are required by the predefined function rotate() in C++?

a) 1

b) 2

c) 3

d) 4

Answer: 3

149. Predefined function rotate() in C++ is available under which header file?

a) math

b) stdio

c) stdlib

livemcqs.com
livemcqs.com

d) algorithm

Answer: algorithm

150. Which of the following algorithm to rotate an array has the maximum time complexity?

a) rotate elements one by one

b) juggling algorithm

c) reversal algorithm

d) using a temporary array

Answer: rotate elements one by one

50+ Rotation Array Operation MCQs with FREE PDF

151. Which of the following is the predefined function for array reversal in javascript?

a) reverse()

b) arr_reverse()

c) array_reverse()

d) rev()

Answer: reverse()

152. Predefined function reverse() in C++ is available under which header file?

a) math

b) stdio

c) stdlib

d) algorithm

Answer: algorithm

153. What will be the resulting array after reversing arr[]={3,5,4,2}?

a) 2,3,5,4

b) 4,2,3,5

c) 5,4,2,3

d) 2,4,5,3

Answer: 2,4,5,3

50+ Reversal Array Operation MCQs with FREE PDF

154. In how many different ways we can reach the end of the array arr[]={1,3,5,8,9}?

a) 1

b) 2

livemcqs.com
livemcqs.com

c) 3

d) 4

Answer: 4

155. It is not possible to reach the end of an array if starting element of the array is 0.

a) true

b) false

Answer: true

156. What is the minimum possible time complexity to find the number of steps to reach the end of
an array?

a) O(n)

b) O(n2)

c) O(n3/2)

d) O (1)

Answer: O(n)

157. What will be the minimum number of jumps required to reach the end of the array arr[] =
{1,3,6,3,6,8,5}?

a) 1

b) 2

c) 3

d) not possible to reach the end

Answer: 3

50+ Number of Jumps to Reach End-array Operation MCQs

158. What is indexed skip list?

a) it stores width of link in place of element

b) it stores index values

c) array based linked list

d) indexed tree

Answer: it stores width of link in place of element

159. What is the time complexity improvement of skip lists from linked lists in insertion and
deletion?

a) O(n) to O(logn) where n is number of elements

b) O(n) to O(1) where n is number of elements

livemcqs.com
livemcqs.com

c) no change

d) O(n) to O(n2) where n is number of elements

Answer: O(n) to O(logn) where n is number of elements

160. To which datastructure are skip lists similar to in terms of time complexities in worst and best
cases?

a) balanced binary search trees

b) binary search trees

c) binary trees

d) linked lists

Answer: balanced binary search trees

50+ Skip List MCQs with FREE PDF

161. Which of the following statements are true?

i) practical application of XOR linked lists are in environments with limited space requirements, such
as embedded devices.

ii)xor lists are not suitable because most garbage collectors will fail to work properly with classes or
structures that don’t contain literal pointers

iii)in order to calculate the address of the next node you need to remember the address of the
previous node

iv)xor lists are much efficient than single, doubly linked lists and arrays

a) i, ii, iii, iv

b) i, ii, iii

c) i, ii

d) i

Answer: i, ii, iii

162. What is xor linked list?

a) uses of bitwise XOR operation to decrease storage requirements for doubly linked lists

b) uses of bitwise XOR operation to decrease storage requirements for linked lists

c) uses of bitwise operations to decrease storage requirements for doubly linked lists

d) just another form of linked list

Answer: uses of bitwise XOR operation to decrease storage requirements for doubly linked lists

163. What does a xor linked list have?

a) every node stores the XOR of addresses of previous and next nodes

livemcqs.com
livemcqs.com

b) actuall memory address of next node

c) every node stores the XOR of addresses of previous and next two nodes

d) every node stores xor 0 and the current node address

Answer: every node stores the XOR of addresses of previous and next nodes

164. What does first and last nodes of a xor linked lists contain ? (let address of first and last be A
and B)

a) NULL xor A and B xor NULL

b) NULL and NULL

c) A and B

d) NULL xor A and B

Answer: NULL xor A and B xor NULL

165. In the above question would using arrays and swaping of elements in place of xor linked list
would have been more efficient?

a) no not all

b) yes arrays would have been better than xor lists

c) both would be same in efficiency

d) can’t say

Answer: 7

166. Which of the following is an advantage of XOR list?

a) Almost of debugging tools cannot follow the XOR chain, making debugging difficult

b) You need to remember the address of the previously accessed node in order to calculate the next
node’s address

c) In some contexts XOR of pointers is not defined

d) XOR list decreases the space requirement in doubly linked list

Answer: XOR list decreases the space requirement in doubly linked list

167. Which of the following is not the properties of XOR lists?

a) X⊕X = 0

b) X⊕0 = X

c) (X⊕Y)⊕Z = X⊕(Y⊕Z)

d) X⊕0 = 1

Answer: X⊕0 = 1

50+ Self Organizing List MCQs with FREE PDF

livemcqs.com
livemcqs.com

168. What is buddy memory management of free lists ?

a) modified version of first fit

b) buddy allocation keeps several free lists, each one holds blocks which are of one particular size

c) modified version of best fit

d) a tree representation of free lists

Answer: buddy allocation keeps several free lists, each one holds blocks which are of one particular
size

169. Free lists are used in

a) static memory allocation

b) dynamic memory allocation

c) contagious allocations

d) are used for speeding up linked list operations

Answer: dynamic memory allocation

170. What are implicit and explicit implementations of freelists?

a) garbage collection and new or malloc operators respectively

b) new or malloc and garbage collection respectively

c) implicit implementation is not favored

d) explicit implementation is not favored

Answer: garbage collection and new or malloc operators respectively

171. What datastructures can be used in implementing a free list?

a) only linked list

b) linked list or sort trees

c) arrays

d) trees

Answer: b

172. How does implicit free lists(garbage collection) works in adding memory to free list ?

a) whichever comes last will be added to free list

b) linked list or sort trees

c) certain blocks cannot be used if there are no pointers to them and hence they can be freed

d) makes a probabilistic guess

Answer: certain blocks cannot be used if there are no pointers to them and hence they can be freed

livemcqs.com
livemcqs.com

50+ Xor Linked List MCQs with FREE PDF

173. What is buddy memory management of free lists ?

a) modified version of first fit

b) buddy allocation keeps several free lists, each one holds blocks which are of one particular size

c) modified version of best fit

d) a tree representation of free lists

Answer: buddy allocation keeps several free lists, each one holds blocks which are of one particular
size

174. Free lists are used in

a) static memory allocation

b) dynamic memory allocation

c) contagious allocations

d) are used for speeding up linked list operations

Answer: dynamic memory allocation

175. What are implicit and explicit implementations of freelists?

a) garbage collection and new or malloc operators respectively

b) new or malloc and garbage collection respectively

c) implicit implementation is not favored

d) explicit implementation is not favored

Answer: garbage collection and new or malloc operators respectively

176. What datastructures can be used in implementing a free list?

a) only linked list

b) linked list or sort trees

c) arrays

d) trees

Answer: linked list or sort trees

177. How does implicit free lists (garbage collection) works in adding memory to free list ?

a) whichever comes last will be added to free list

b) whichever comes first will be added to free list

c) certain blocks cannot be used if there are no pointers to them and hence they can be freed

d) makes a probabilistic guess

livemcqs.com
livemcqs.com

Answer: certain blocks cannot be used if there are no pointers to them and hence they can be freed

178. What are the disadvantages in implementing buddy system algorithm for free lists?

a) internal fragmentation

b) it takes so much space

c) we no more have the hole lists in order of memory address, so it is difficult to detect if 2 holes
remain adjacent in memory and shall be merged into one hole

d) both a and c are correct

Answer: both a and c are correct

50+ Free List MCQs with FREE PDF

179. What may be the psuedo code for finding the size of a tree?

a) find_size(root_node–>left_node) + 1 + find_size(root_node–>right_node)

b) find_size(root_node–>left_node) + find_size(root_node–>right_node)

c) find_size(root_node–>right_node) – 1

d) find_size(root_node–>left_node + 1

Answer: find_size(root_node–>left_node) + 1 + find_size(root_node–>right_node)

50+ Binary Trees using Array MCQs with FREE PDF

180. How many types of insertion are performed in a binary tree?

a) 1

b) 2

c) 3

d) 4

Answer: 2

181. What is the maximum number of children that a binary tree node can have?

a) 0

b) 1

c) 2

d) 3

Answer: 2

50+ Binary Trees using Linked Lists MCQs with FREE PDF

182. 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)

livemcqs.com
livemcqs.com

b) O(nlogd)

c) O(logd)

d) O(d)

Answer: O(nlogd)

183. 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: Pre-order traversal

184. 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: A, B, C, E, D

50+ Binary Tree Operations MCQs with FREE PDF

185. 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

186. 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

187. Which of the following pair’s traversals on a binary tree can build the tree uniquely?

livemcqs.com
livemcqs.com

a) post-order and pre-order

b) post-order and in-order

c) post-order and level order

d) level order and preorder

Answer: b

50+ Preorder Traversal MCQs with FREE PDF

188. What is the time complexity of level order traversal?

a) O(1)

b) O(n)

c) O(logn)

d) O(nlogn)

Answer: b

189. 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

190. 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

50+ Postorder Traversal MCQs with FREE PDF

191. 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

livemcqs.com
livemcqs.com

Answer: L = I + 1

192. 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: N = 2*I + 1

193. 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: A binary tree, which is completely filled, with the possible exception of the bottom level,
which is filled from left to right

50+ Inorder Traversal MCQs with FREE PDF

194. 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

195. 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: In order sequence gives decreasing order of elements

50+ Binary Tree Properties MCQs with FREE PDF

196. A binary tree is balanced if the difference between left and right subtree of every node is not
more than ____

livemcqs.com
livemcqs.com

a) 1

b) 3

c) 2

d) 0

Answer: 1

197. Which of the following is an advantage of balanced binary search tree, like AVL tree, compared
to binary heap?

a) insertion takes less time

b) deletion takes less time

c) searching takes less time

d) construction of the tree takes less time than binary heap

Answer: insertion takes less time

50+ Binary Search Tree MCQs with FREE PDF

198. 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

199. Which of the following is not the self balancing binary search tree?

a) AVL Tree

b) 2-3-4 Tree

c) Red – Black Tree

d) Splay Tree

Answer: b

200. 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

livemcqs.com
livemcqs.com

201. 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

202. Binary tree sort implemented using a self balancing binary search tree takes O(n log n) time in
the worst case but still it is slower than merge sort.

a) True

b) False

Answer: a

203. Self – balancing binary search trees have a much better average-case time complexity than hash
tables.

a) True

b) False

Answer: b

50+ Balanced Binary Tree MCQs with FREE PDF

204. What is the expected number of leaves in a randomized binary search tree?

a) n + 1

b) (n + 1)/3

c) (n + 1)/2

d) n + 3

Answer: b

205. Which of the following is not a random tree?

a) Treap

b) Random Binary Tree

c) Uniform Spanning Tree

d) AVL Tree

livemcqs.com
livemcqs.com

Answer: d

206. Which process forms the randomized binary search tree?

a) Stochastic Process

b) Branching Process

c) Diffusion Process

d) Aggregation Process

Answer: a

50+ Self Balancing Binary Search Tree MCQs with FREE PDF

207. AA Trees are implemented using?

a) Colors

b) Levels

c) Node size

d) Heaps

Answer: b

208. Which of the following is the correct definition for a horizontal link?

a) connection between node and a child of equal levels

b) connection between two nodes

c) connection between two child nodes

d) connection between root node and leaf node

Answer: a

209. What is the worst case analysis of an AA-Tree?

a) O(N)

b) O(log N)

c) O( N log N)

d) O(N2)

Answer: b

210. How will you remove a left horizontal link in an AA-tree?

a) by performing right rotation

b) by performing left rotation

c) by deleting both the elements

d) by inserting a new element

livemcqs.com
livemcqs.com

Answer: a

50+ Randomized Binary Search Tree MCQs with FREE PDF

211. 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 tree which is balanced and is a height balanced tree

212. 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: to avoid formation of skew trees

213. 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: AVL tree store balance factor in every node which costs space

214. To restore the AVL property after inserting a element, we start at the insertion point and move
towards root of that tree. is this statement true?

a) true

b) false

Answer: true

215. 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: find the median of the set of elements given, make it as root and construct the tree

livemcqs.com
livemcqs.com

50+ AA Tree MCQs with FREE PDF

216. Which of the below statements are true?

i. Cartesian tree is not a height balanced tree

ii. Cartesian tree of a sequence of unique numbers can be unique generated

a) both statements are true

b) only i. is true

c) only ii. is true

d) both are false

Answer: both statements are true

217. Cartesian trees are most suitable for?

a) searching

b) finding nth element

c) minimum range query and lowest common ancestors

d) self balancing a tree

Answer: minimum range query and lowest common ancestors

50+ AVL Tree MCQs with FREE PDF

218. What is the condition for a tree to be weight balanced. where a is factor and n is a node?

a) weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].

b) weight[n.left] >= a*weight[n.right] and weight[n.right] >= a*weight[n].

c) weight[n.left] >= a*weight[n.left] and weight[n.right] >= a*weight[n].

d) weight[n] is a non zero

Answer: weight[n.left] >= a*weight[n] and weight[n.right] >= a*weight[n].

219. What are the operations that can be performed on weight balanced tree?

a) all basic operations and set intersection, set union and subset test

b) all basic operations

c) set intersection, set union and subset test

d) only insertion and deletion

Answer: all basic operations and set intersection, set union and subset test

220. What is a weight balanced tree?

a) A binary tree that stores the sizes of subtrees in nodes

b) A binary tree with an additional attribute of weight

livemcqs.com
livemcqs.com

c) A height balanced binary tree

d) A normal binary tree

Answer: A binary tree that stores the sizes of subtrees in nodes

50+ Cartesian Tree MCQs with FREE PDF

221. Which of the following is an application of Red-black trees and why?

a) used to store strings efficiently

b) used to store integers efficiently

c) can be used in process schedulers, maps, sets

d) for efficient sorting

Answer: can be used in process schedulers, maps, sets

222. When it would be optimal to prefer Red-black trees over AVL trees?

a) when there are more insertions or deletions

b) when more search is needed

c) when tree must be balanced

d) when log(nodes) time complexity is needed

Answer: when there are more insertions or deletions

223. Why Red-black trees are preferred over hash tables though hash tables have constant time
complexity?

a) no they are not preferred

b) because of resizing issues of hash table and better ordering in redblack trees

c) because they can be implemented using trees

d) because they are balanced

Answer: because of resizing issues of hash table and better ordering in redblack trees

224. How can you save memory when storing color information in Red-Black tree?

a) using least significant bit of one of the pointers in the node for color information

b) using another array with colors of each node

c) storing color information in the node structure

d) using negative and positive numbering

Answer: using least significant bit of one of the pointers in the node for color information

50+ Weight Balanced Tree MCQs with FREE PDF

225. How many edges are present in Edge cluster?

livemcqs.com
livemcqs.com

a) 0

b) 1

c) 2

d) 4

Answer: 1

226. Which data structure is used to maintain a dynamic forest using a link or cut operation?

a) Top Tree

b) Array

c) Linked List

d) Stack

Answer: Top Tree

227. What is the time complexity for the initialization of top tree?

a) O (n)

b) O (n2)

c) O (log n)

d) O (n!)

Answer: O (n)

228. How many top trees are there in a tree with single vertex?

a) 0

b) 1

c) 2

d) 3

Answer: 0

50+ Red Black Tree MCQs with FREE PDF

229. Which of the following options is an application of splay trees?

a) cache Implementation

b) networks

c) send values

d) receive values

Answer: a

230. What are splay trees?

livemcqs.com
livemcqs.com

a) self adjusting binary search trees

b) self adjusting binary trees

c) a tree with strings

d) a tree with probability distributions

Answer: a

231. Which of the following property of splay tree is correct?

a) it holds probability usage of the respective sub trees

b) any sequence of j operations starting from an empty tree with h nodes atmost, takes O(jlogh)
time complexity

c) sequence of operations with h nodes can take O(logh) time complexity

d) splay trees are unstable trees

Answer: b

232. Why to prefer splay trees?

a) easier to program

b) space efficiency

c) easier to program and faster access to recently accessed items

d) quick searching

Answer: c

233. When we have red-black trees and AVL trees that can perform most of operations in
logarithmic times, then what is the need for splay trees?

a) no there is no special usage

b) In real time it is estimated that 80% access is only to 20% data, hence most used ones must be
easily available

c) redblack and avl are not upto mark

d) they are just another type of self balancing binary search trees

Answer: b

50+ Top Tree MCQs with FREE PDF

234. Which is the simplest of all binary search trees?

a) AVL tree

b) Treap

c) Splay tree

d) Binary heap

livemcqs.com
livemcqs.com

Answer: Treap

235. What is the condition for priority of a node in a treap?

a) a node’s priority should be greater than its parent

b) a node’s priority should be at least as large as its parent

c) the priority is randomly assigned and can have any value

d) a node’s priority is always given in decreasing order

Answer: a node’s priority should be at least as large as its parent

236. What is the average running time of a treap?

a) O(N)

b) O(N log N)

c) O(log N)

d) O(M log N)

Answer: O(log N)

237. Which node has the lowest priority in a treap?

a) root node

b) leaf node

c) null node

d) centre node

Answer: root node

50+ Splay Tree MCQs with FREE PDF

238. What is the space complexity of a treap algorithm?

a) O(N)

b) O(log N)

c) O(log N)

d) O(N2)

Answer: O(N)

239. A treap is a combination of a tree and a heap.

a) false

b) true

Answer: true

240. Which is the simplest of all binary search trees?

livemcqs.com
livemcqs.com

a) AVL tree

b) Treap

c) Splay tree

d) Binary heap

Answer: Treap

50+ Treap MCQs with FREE PDF

241. Who developed the concept of tango tree?

a) Erik Demaine

b) Mihai Patrascu

c) John Lacono

d) All of the mentioned

Answer: All of the mentioned

242. Which type of tree is tango tree?

a) Ternary Tree

b) AVL Tree

c) Binary Search Tree

d) K-ary Tree

Answer: Binary Search Tree

243. After which city is tango tree named?

a) Vatican City

b) Buenos Aires

c) New York

d) California

Answer: Buenos Aires

244. Which type of binary search tree is imitated for construction of tango tree?

a) Complete Binary Search Tree

b) Perfect Binary Search Tree

c) Balanced Binary Search Tree

d) Degenerate Binary Search Tree

Answer: Complete Binary Search Tree

245. Which special balanced binary search tree is used to store the nodes of auxiliary tree?

livemcqs.com
livemcqs.com

a) Red – Black Tree

b) Red – Brown Tree

c) Red – Yellow Tree

d) Red – Tango Tree

Answer: Red – Black Tree

246. What is the time complexity for searching k+1 auxiliary trees?

a) k+2 O (log (log n))

b) k+1 O (log n)

c) K+2 O (log n)

d) k+1 O (log (log n))

Answer: k+1 O (log (log n))

247. Which operation is used to combine two auxiliary trees?

a) Join

b) Combinatorial

c) Add

d) Concatenation

Answer: Join

50+ Threaded Binary Tree MCQs with FREE PDF

248. Which of the following is also known as Rope data structure?

a) Cord

b) String

c) Array

d) Linked List

Answer: Cord

249. Which type of data structure does rope represent?

a) Array

b) Linked List

c) Queue

d) Binary Tree

Answer: Binary Tree

250. What is the time complexity for finding the node at x position where n is the length of the rope?

livemcqs.com
livemcqs.com

a) O (log n)

b) O (n!)

c) O (n2)

d) O (1)

Answer: O (log n)

50+ Tango Tree MCQs with FREE PDF

251. Which of the following is also known as Rope data structure?

a) Cord

b) String

c) Array

d) Linked List

Answer: Cord

252. Which type of data structure does rope represent?

a) Array

b) Linked List

c) Queue

d) Binary Tree

Answer: Binary Tree

253. What is the time complexity for finding the node at x position where n is the length of the rope?

a) O (log n)

b) O (n!)

c) O (n2)

d) O (1)

Answer: O (log n)

254. Which type of binary tree does rope require to perform basic operations?

a) Unbalanced

b) Balanced

c) Complete

d) Full

Answer: Balanced

50+ Rope MCQs with FREE PDF

livemcqs.com
livemcqs.com

255. 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: at least (n – 1)/2 keys

256. 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: 255

257. B-tree and AVL tree have the same worst case time complexity for insertion and deletion.

a) True

b) False

Answer: True

258. 2-3-4 trees are B-trees of order 4. They are an isometric of _____ trees.

a) AVL

b) AA

c) 2-3

d) Red-Black

Answer: Red-Black

259. 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: logn (k+1) – 1

260. 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

livemcqs.com
livemcqs.com

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: larger the order of B-tree, less frequently the split occurs

Top B-Tree MCQs with FREE PDF

161. An expression tree is created using?

a) postfix expression

b) prefix expression

c) infix expression

d) paranthesized expression

Answer: postfix expression

262. ++a*bc*+defg is an?

a) postfix expression

b) infix expression

c) prefix expression

d) invalid expression

Answer: prefix expression

267. An expression tree’s nodes can be deleted by calling?

a) malloc

b) calloc

c) delete

d) free

Answer: free

268. In an expression tree algorithm, what happens when an operand is encountered?

a) create one node pointing to a stack

b) pop the nodes from the stack

c) clear stack

d) merge all the nodes

Answer: create one node pointing to a stack

269. The leaves of an expression tree always contain?

a) operators

b) operands

livemcqs.com
livemcqs.com

c) null

d) expression

Answer: operands

270. What does the other nodes of an expression tree(except leaves) contain?

a) only operands

b) only operators

c) both operands and operators

d) expression

Answer: only operators

50+ Expression Tree MCQs with FREE PDF

271. Each level in a k-d tree is made of?

a) dimension only

b) cutting and dimension

c) color code of node

d) size of the level

Answer: cutting and dimension

272. What is the worst case of finding the nearest neighbour?

a) O(N)

b) O(N log N)

c) O( log N)

d) O(N3)

Answer: O(N)

273. What is the run time of finding the nearest neighbour in a k-d tree?

a) O(2+ log N)

b) O( log N)

c) O(2d log N)

d) O( N log N)

Answer: O(2d log N)

274. How many prime concepts are available in nearest neighbour search in a kd tree?

a) 1

b) 2

livemcqs.com
livemcqs.com

c) 3

d) 4

Answer: 3

275. Reducing search space by eliminating irrelevant trees is known as?

a) pruning

b) partial results

c) freeing space

d) traversing

Answer: pruning

276. Several kinds of queries are possible on a k-d called as?

a) partial queries

b) range queries

c) neighbour queries

d) search queries

Answer: range queries

277. What is the time taken for a range query for a perfectly balanced tree?

a) O(N)

b) O(log N)

c) O(√N+M)

d) O(√N)

Answer: O(√N+M)

50+ KD Tree MCQs with FREE PDF

278. What is the worst case time complexity of insertion operation(n =no. of candidates)?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

279. What is computational geometry?

a) study of geometry using a computer

b) study of geometry

livemcqs.com
livemcqs.com

c) study of algorithms

d) study of algorithms related to geometry

Answer: study of algorithms related to geometry

280. What will be the time complexity of query operation if all the candidates are evenly spaced so
that each bin has constant no. of candidates? (k = number of bins query rectangle intersects)

a) O(1)

b) O(k)

c) O(k2)

d) O(log k)

Answer: O(k)

50+ Bin MCQs with FREE PDF

281. Which of these operations have same complexities?

a) Insertion, find_min

b) Find_min, union

c) Union, Insertion

d) Deletion, Find _max

Answer: Union, Insertion

282. Given a heap of n nodes. The maximum number of tree for building the heap is.

a) n

b) n-1

c) n/2

d) logn

Answer: n

50+ Binary Heap MCQs with FREE PDF

283. What is the basic operation performed in a pairing heap?

a) merge

b) deletion

c) insertion

d) swapping

Answer: merge

284. If there are c children of the root, how many calls to the merge procedure is required to
reassemble the heap?

livemcqs.com
livemcqs.com

a) c

b) c+1

c) c-1

d) 1

Answer: c-1

285. Out of the following given options, which is the fastest algorithm?

a) fibonacci heap

b) pairing heap

c) d-ary heap

d) binary heap

Answer: fibonacci heap

50+ Pairing Heap MCQs with FREE PDF

286. The procedure FindMin() to find the minimum element and the procedure DeleteMin() to
delete the minimum element in min heap take _________

a) logarithmic and linear time constant respectively

b) constant and linear time respectively

c) constant and quadratic time respectively

d) constant and logarithmic time respectively

Answer: constant and logarithmic time respectively

287. Which one of the following array elements represents a binary min heap?

a) 12 10 8 25 14 17

b) 8 10 12 25 14 17

c) 25 17 14 12 10 8

d) 14 17 25 10 12 8

Answer: 8 10 12 25 14 17

50+ Min/Max Heap MCQs with FREE PDF

288. Which of the following operations does not destroy the leftist heap property?

a) insert

b) merge

c) delete

d) swap

livemcqs.com
livemcqs.com

Answer: delete

289. What is the fundamental operation on leftist heap?

a) insertion

b) merging

c) deletion

d) swapping

Answer: merging

50+ Leftlist Heap MCQs with FREE PDF

290. What is the fundamental operation performed in skew heaps?

a) intersection

b) difference

c) merging

d) sorting

Answer: merging

291. What is the time per operation of merging, insertion and deletion operations in a skew heap?

a) O(N)

b) O(log N)

c) O(N log N)

d) O(N2)

Answer: O(log N)

292. Why would a recursive implementation fail in skew heaps?

a) skew heaps are self adjusting

b) efficiency gets reduced

c) lack of stack space

d) time complexity

Answer: lack of stack space

50+ Skew Heap MCQs with FREE PDF

293. What is the process of building a ternary heap called?

a) Heapify

b) Hashing

c) Linking

livemcqs.com
livemcqs.com

d) Merging

Answer: Heapify

394. Which type of data structure is a ternary heap?

a) Array

b) Hash

c) Priority Queue

d) Priority Stack

Answer: Priority Queue

295. What is a ternary heap?

a) An array with three elements

b) Linked list with three elements

c) Tree with three children

d) Heap with all nodes having three children

Answer: Heap with all nodes having three children

296. Who invented d-ary heap?

a) Carl Rick

b) Alan Turing

c) Donald Johnson

d) Euclid

Answer: Donald Johnson

50+ Ternary Heap MCQs with FREE PDF

297. Which of these operations have same complexities?

a) Insertion, find_min

b) Find_min, union

c) Union, Insertion

d) Deletion, Find _max

Answer: Union, Insertion

298. Given a heap of n nodes. The maximum number of tree for building the heap is.

a) n

b) n-1

c) n/2

livemcqs.com
livemcqs.com

d) logn

Answer: n

299. Choose the option with function having same complexity for a fibonacci heap.

a) Insertion, Union

b) Insertion, Deletion

c) extract_min, insertion

d) Union, delete

Answer: Insertion, Union

50+ Binomial and Fibonacci Heap MCQs with FREE PDF

300. The total comparisons in finding both smallest and largest elements are

a) 2*n +2

b) n + ((n+1)/2) -2

c) n+logn

d) n2

Answer: n + ((n+1)/2) -2

301. The leaf node for a heap of height h will be at which position.

a) h

b) h-1

c) h or h-1

d) h-2

Answer: h or h-1

50+ Weak Heap MCQs with FREE PDF

302. What is the fundamental operation performed in skew heaps?

a) intersection

b) difference

c) merging

d) sorting

Answer: merging

303. What is the time per operation of merging, insertion and deletion operations in a skew heap?

a) O(N)

b) O(log N)

livemcqs.com
livemcqs.com

c) O(N log N)

d) O(N2)

Answer: O(log N)

50+ Skew Heap MCQs with FREE PDF

304. What is the run time efficiency of an insertion algorithm in d-heap?

a) O(N)

b) O(log N)

c) O(logd N)

d) O(Nd)

Answer: O(logd N)

305. How many comparisons will occur while performing a delete-min operation?

a) d

b) d-1

c) d+1

d) 1

Answer: d-1

306. How many basic operations can be performed in a d-heap?

a) 1

b) 2

c) 3

d) 4

Answer: 2

50+ D-ary Heap MCQs with FREE PDF

307. Which of the following special type of trie is used for fast searching of the full texts?

a) Ctrie

b) Hash tree

c) Suffix tree

d) T tree

Answer: Suffix tree

308. Which statement is correct of suffix tree with a string of length n?

a) The tree has n leaves

livemcqs.com
livemcqs.com

b) The tree has n roots

c) Height of Tree is n

d) Depth of tree is n

Answer: The tree has n leaves

309. Which tree allows fast implementation of string operation?

a) Rope Tree

b) Suffix Tree

c) Tango Tree

d) Top Tree

Answer: Suffix Tree

310. How much time does construction of suffix tree take?

a) O (log M)

b) O (M!)

c) Exponential to Length of Tree

d) Linear to Length of Tree

Answer: Linear to Length of Tree

50+ Suffix Tree (Data Structure) MCQs with FREE PDF

311. Which of the following is the hashing function for separate chaining?

a) H(x)=(hash(x)+f(i)) mod table size

b) H(x)=hash(x)+i2 mod table size

c) H(x)=x mod table size

d) H(x)=x mod (table size * 2)

Answer: H(x)=x mod table size

312. What is the correct notation for a load factor?

a) Ω

b) ∞

c) ∑

d) ⅄

Answer: ⅄

313. In hash tables, how many traversal of links does a successful search require?

a) 1+⅄

livemcqs.com
livemcqs.com

b) 1+⅄2

c) 1+ (⅄/2)

d) ⅄3

Answer: 1+ (⅄/2)

314. Which of the following is a disadvantage of using separate chaining using linked lists?

a) It requires many pointers

b) It requires linked lists

c) It uses array

d) It does not resolve collision

Answer: It requires many pointers

50+ Hash Tables Chaining using Linked Lists MCQs PDF Download

315. What is the time complexity of search function in a hash table using a doubly linked list?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

316. What is the time complexity of delete function in the hash table using a doubly linked list?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

50+ Hash Tables Chaining using Doubly Linked Lists MCQs PDF Download

317. What is the time complexity of the search function in a hash table using a binary tree?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

318. What is the disadvantage of BST over the hash table?

livemcqs.com
livemcqs.com

a) BST is easier to implement

b) BST can get the keys sorted by just performing inorder traversal

c) BST can perform range query easily

d) Time complexity of hash table in inserting, searching and deleting is less than that of BST

Answer: Time complexity of hash table in inserting, searching and deleting is less than that of BST

319. Which of the following technique stores data separately in case of a collision?

a) Open addressing

b) Double hashing

c) Quadratic probing

d) Chaining using a binary tree

Answer: Chaining using a binary tree

50+ Hash Tables Chaining with Binary Trees MCQs PDF Download

320. In linear probing, the cost of an unsuccessful search can be used to compute the average cost of
a successful search.

a) True

b) False

Answer: True

321. Which of the following is the correct function definition for linear probing?

a) F(i)= 1

b) F(i)=i

c) F(i)=i2

d) F(i)=i+1

Answer: F(i)=i

322. ___________ is not a theoretical problem but actually occurs in real implementations of
probing.

a) Hashing

b) Clustering

c) Rehashing

d) Collision

Answer: Clustering

50+ Hash Tables with Linear Probing MCQs PDF Download

323. What is the time complexity of search function in a hash table using list head?

livemcqs.com
livemcqs.com

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

324. What is the time complexity of delete function in the hash table using list head?

a) O(1)

b) O(n)

c) O(log n)

d) O(n log n)

Answer: O(1)

325. Which of the following trait of a hash function is most desirable?

a) it should cause less collisions

b) it should cause more collisions

c) it should occupy less space

d) it should be easy to implement

Answer: it should cause less collisions

50+ Hash Tables Chaining with List Heads MCQs PDF Download

326. How many constraints are to be met to successfully implement quadratic probing?

a) 1

b) 2

c) 3

d) 4

Answer: 2

327. Which among the following is the best technique to handle collision?

a) Quadratic probing

b) Linear probing

c) Double hashing

d) Separate chaining

Answer: Quadratic probing

328. Which of the following techniques offer better cache performance?

livemcqs.com
livemcqs.com

a) Quadratic probing

b) Linear probing

c) Double hashing

d) Rehashing

Answer: Linear probing

50+ Hash Tables with Quadratic Probing MCQs PDF Download

329. 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: Any prime number

330. Which scheme provides good performance?

a) open addressing

b) universal hashing

c) hashing by division

d) hashing by multiplication

Answer: universal hashing

331. 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: 15

332. How many steps are involved in creating a hash function using a multiplication method?

a) 1

b) 4

c) 3

d) 2

Answer: 2

livemcqs.com
livemcqs.com

50+ Hashing Functions MCQs PDF Download

333. Which technique has the greatest number of probe sequences?

a) Linear probing

b) Quadratic probing

c) Double hashing

d) Closed hashing

Answer: Closed hashing

334. What is the value of m’ if the value of m is 19?

a) 11

b) 18

c) 17

d) 15

Answer: 17

335. The value of h2(k) can be composite relatively to the hash table size m.

a) True

b) False

Answer: False

50+ Double Hashing MCQs PDF Download

336. Hash tree is also known as _____

a) Merkle tree

b) T -tree

c) Hash table

d) Bx-tree

Answer: Merkle tree

337. What will be the height of the hash tree with branching factor 2 and with 8 records?

a) 3

b) 5

c) 4

d) 6

Answer: 4

338. Where is the hash tree used?

livemcqs.com
livemcqs.com

a) in digital currency

b) in sorting of large data

c) for indexing in databases

d) in encryption of data

Answer: in digital currency

339. What is the worst case time complexity of the insertion in the hash tree?

a) O(logk(n))

b) O(n2)

c) O(nlogk(n))

d) O(kn)

Answer: O(logk(n))

50+ Hash Tree MCQs PDF Download

340. Which indicator is used for similarity between two sets?

a) Rope Tree

b) Jaccard Coefficient

c) Tango Tree

d) MinHash Coefficient

Answer: Jaccard Coefficient

341. Which of the following is defined as the ratio of total elements of intersection and union of two
sets?

a) Rope Tree

b) Jaccard Coefficient Index

c) Tango Tree

d) MinHash Coefficient

Answer: Jaccard Coefficient Index

342. What is the value of the Jaccard index when the two sets are disjoint?

a) 1

b) 2

c) 3

d) 0

Answer: 0

livemcqs.com
livemcqs.com

343. When are the members of two sets more common relatively?

a) Jaccard Index is Closer to 1

b) Jaccard Index is Closer to 0

c) Jaccard Index is Closer to -1

d) Jaccard Index is Farther to 1

Answer: Jaccard Index is Closer to 1

50+ Min Hash MCQs PDF Download

344. What is the advantage of using a dynamic set in direct addressing?

a) It saves time

b) It saves space

c) It saves both time and space

d) It reduces code complexity

Answer: It saves space

345. What is the time complexity to delete an element from the direct address table?

a) O(n)

b) O(logn)

c) O(nlogn)

d) O(1)

Answer: O(1)

50+ Direct Addressing Tables MCQs PDF Download

346. If A[x+3][y+5] represents an adjacency matrix, which of these could be the value of x and y.

a) x=5, y=3

b) x=3, y=5

c) x=3, y=3

d) x=5, y=5

Answer: x=5, y=3

347. Two directed graphs(G and H) are isomorphic if and only if A=PBP-1, where P and A are
adjacency matrices of G and H respectively.

a) True

b) False

Answer: True

livemcqs.com
livemcqs.com

50+ Adjacency Matrix MCQs PDF Download

348. Time complexity to check if an edge exists between two vertices would be ___________

a) O(V*V)

b) O(V+E)

c) O(1)

d) O(E)

Answer: O(E)

349. If a connected Graph (G) contains n vertices what would be the rank of its incidence matrix?

a) n-1

b) values greater than n are possible

c) values less than n-1 are possible

d) insufficient Information is given

Answer: n-1

350. A Graph Structured Stack is a _____________

a) Undirected Graph

b) Directed Graph

c) Directed Acyclic Graph

d) Regular Graph

Answer: Directed Acyclic Graph

351. If a Graph Structured Stack contains {1,2,3,4} {1,5,3,4} {1,6,7,4} and {8,9,7,4}, what would be the
source and sink vertices of the DAC?

a) Source – 1, 8 Sink – 7,4

b) Source – 1 Sink – 8,4

c) Source – 1, 8 Sink – 4

d) Source – 4, Sink – 1,8

Answer: Source – 1, 8 Sink – 4

352. Graph Structured Stack finds its application in _____________

a) Bogo Sort

b) Tomita’s Algorithm

c) Todd–Coxeter algorithm

d) Heap Sort

livemcqs.com
livemcqs.com

Answer: Tomita’s Algorithm

353. If in a DAG N sink vertices and M source vertices exists, then the number of possible stacks in
the Graph Structured Stack representation would come out to be N*M.

a) True

b) False

Answer: False

354. The column sum in an incidence matrix for a simple graph is __________

a) depends on number of edges

b) always greater than 2

c) equal to 2

d) equal to the number of edges

Answer: equal to 2

355. What are the dimensions of an incidence matrix?

a) Number of edges*number of edges

b) Number of edges*number of vertices

c) Number of vertices*number of vertices

d) Number of edges * (1⁄2 * number of vertices)

Answer: Number of edges*number of vertices

50+ Incidence Matrix and Graph Structured Stack MCQs PDF Download

356. Space complexity for an adjacency list of an undirected graph having large values of V (vertices)
and E (edges) is __________

a) O(V)

b) O(E*E)

c) O(E)

d) O(E+V)

Answer: O(E)

357. Space complexity for an adjacency list of an undirected graph having large values of V (vertices)
and E (edges) is ___________

a) O(E)

b) O(V*V)

c) O(E+V)

d) O(V)

livemcqs.com
livemcqs.com

Answer: O(E+V)

358. Time complexity to find if there is an edge between 2 particular vertices is _________

a) O(V)

b) O(E)

c) O(1)

d) O(V+E)

Answer: O(V)

50+ Adjacency List MCQs PDF Download

359. 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: n-2

360. 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: O(V*V)

361. 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: 2((n*n)/2)

50+ Undirected Graph MCQs PDF Download

362. Assuming value of every weight to be greater than 10, in which of the following cases the
shortest path of a directed weighted graph from 2 vertices u and v will never change?

a) add all values by 10

livemcqs.com
livemcqs.com

b) subtract 10 from all the values

c) multiply all values by 10

d) in both the cases of multiplying and adding by 10

Answer: multiply all values by 10

363. What is the maximum possible number of edges in a directed graph with no self loops having 8
vertices?

a) 28

b) 64

c) 256

d) 56

Answer: 56

364. A graph having an edge from each vertex to every other vertex is called a ___________

a) Tightly Connected

b) Strongly Connected

c) Weakly Connected

d) Loosely Connected

Answer: Tightly Connected

365. What is the number of unlabeled simple directed graph that can be made with 1 or 2 vertices?

a) 2

b) 4

c) 5

d) 9

Answer: 4

50+ Directed Graph MCQs PDF Download

366. 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: No Hamiltonian path is possible

367. Which of the given statement is true?

livemcqs.com
livemcqs.com

a) All the Cyclic Directed Graphs have topological sortings

b) All the Acyclic Directed Graphs have topological sortings

c) All Directed Graphs have topological sortings

d) All the cyclic directed graphs hace non topological sortings

Answer: All the cyclic directed graphs hace non topological sortings

368. For any two different vertices u and v of an Acyclic Directed Graph if v is reachable from u, u is
also reachable from v?

a) True

b) False

Answer: False

369. 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: Will always be zero

50+ Directed Acyclic Graph MCQs PDF Download

370. In which of the following case does a Propositional Directed Acyclic Graph is used for?

a) Representation of Boolean Functions

b) String Matching

c) Searching

d) Sorting of number

Answer: Representation of Boolean Functions

371. Every Binary Decision Diagram is also a Propositional Directed Acyclic Graph.

a) True

b) False

Answer: True

372. In a Propositional Directed Acyclic Graph Leaves maybe labelled with a boolean variable.

a) True

b) False

Answer: True

livemcqs.com
livemcqs.com

373. Which of the following symbols represent nodes having exactly one child?

i) Δ ii) ◊ iii) ∇ iv) T v) ⊥

a) iv) and v)

b) v)

c) i) and iii)

d) iii)

Answer: iii)

50+ Propositional and Directed Acyclic Word Graph MCQs PDF Download

374. Given Adjacency matrices determine which of them are PseudoGraphs?

i) {{1,0} {0,1}}

ii) {{0,1}{1,0}}

iii) {{0,0,1}{0,1,0}{1,0,0}}

a) only i)

b) ii) and iii)

c) i) and iii)

d) i) ii) and iii)

Answer: i) and iii)

375. Which of the following is a HyperGraph, where V is the set of vertices, E is the set of edges?

a) V = {v1, v2, v3} E = {e1, e2} = {{v2, v3} {v1, v3}}

b) V = {v1, v2} E = {e1} = {{v1, v2}}

c) V = {v1, v2, v3} E = {e1, e2, e3} = {{v2, v3}{v3, v1}{v2, v1}}

d) All of the mentioned

Answer: All of the mentioned

376. Given Adjacency matrices determine which of them are PseudoGraphs?

i) {{1,0} {0,1}}

ii) {{0,1}{1,0}}

iii) {{0,0,1}{0,1,0}{1,0,0}}

a) only i)

b) ii) and iii)

c) i) and iii)

d) i) ii) and iii)

livemcqs.com
livemcqs.com

Answer: i) and iii)

50+ Multigraph and Hypergraph MCQs PDF Download

377. How many nodes are required to create a Binary Decision Tree having 4 variables?

a) 24

b) 24-1

c) 25

d) 25-1

Answer: 25-1

378. Size of an And Inverter Graph is the number of _______ gates and the number of logic levels is
number of ________ gates on the __________ path from a primary input to a primary output.

a) AND, AND, average

b) AND, OR, longest

c) OR, OR, shortest

d) AND, AND, longest

Answer: AND, AND, longest

379. And Inverter Graph is a type of __________

a) Multigraph

b) Cyclic Graph

c) Directed Acyclic Graph

d) Directed Acyclic Word Graph

Answer: Directed Acyclic Graph

380. Which of the following logical operation can’t be implemented by polynomial time graph
manipulation algorithms using Binary Decision Diagrams?

a) Conjunction

b) Disjunction

c) Negation

d) Tautology Checking

Answer: Tautology Checking

50+ Binary Decision Diagrams and Inverter Graph MCQs PDF Download

livemcqs.com
livemcqs.com

livemcqs.com

You might also like