Unit 2 MCQ
Unit 2 MCQ
Unit 2 MCQ
a) Create
b) Push
c) Evaluation
d) Pop
Answer: b
a) Create
b) Push
c) Evaluation
d) Pop
Answer: d
3. In a stack, if a user tries to remove an element from empty stack it is called _________
a) Underflow
b) Empty collection
c) Overflow
d) Garbage Collection
Answer: a
4. Pushing an element into stack already having five elements and stack size of 5, then stack becomes
a) Overflow
b) Crash
c) Underflow
1 www.studymaterialz.in
CS8391 DATA STRUCTURES
d) User flow
Answer: a
Answer: d
Answer: d
7. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
The maximum number of parentheses that appear on the stack AT ANY ONE TIME when the algorithm
analyzes: (()(())(())) are:
a) 1
b) 2
c) 3
Answer: c
8. Consider the usual algorithm for determining whether a sequence of parentheses is balanced.
Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in
some order).
The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?
a) 1
b) 2
Answer: b
2 www.studymaterialz.in
CS8391 DATA STRUCTURES
a) 1
b) 40
c) 74
d) -18
Answer: d
10. Here is an infix expression: 4 + 3*(6*3-12). Suppose that we are using the usual stack algorithm to
convert the expression from infix to postfix notation.
The maximum number of symbols that will appear on the stack AT ONE TIME during the conversion of this
expression?
a) 1
b) 2
c) 3
Answer: d
11. The postfix form of the expression (A+ B)*(C*D- E)*F / G is?
b) AB + CD* E – F **G /
c) AB + CD* E – *F *G /
d) AB + CDE * – * F *G /
Answer: c
12. The data structure required to check whether an expression contains balanced parenthesis is?
a) Stack
b) Queue
c) Array
d) Tree
Answer: a
3 www.studymaterialz.in
CS8391 DATA STRUCTURES
13. What data structure would you mostly likely see in a non recursive implementation of a recursive
algorithm?
a) Linked List
b) Stack
c) Queue
d) Tree
Answer: b
14. The process of accessing data stored in a serial access memory is similar to manipulating data on a
________
a) Heap
b) Binary Tree
c) Array
d) Stack
Answer: d
a) *AB/CD+
b) AB*CD/+
c) A*BC+/D
d) ABCD+/*
Answer: b
16. Which data structure is needed to convert infix notation to postfix notation?
a) Branch
b) Tree
c) Queue
d) Stack
Answer: d
a) -/*^ACBDE
4 www.studymaterialz.in
CS8391 DATA STRUCTURES
b) -ABCD*^DE
c) -A/B*C^DE
d) -A/BC*^DE
Answer: c
a) X
b) X+S
c) S
Answer: a
a) + pq – *rt
b) – +pqr * t
c) – +pq * rt
d) – + * pqrt
Answer: c
a) Queue
b) Stack
c) Array
d) List
Answer: b
c) It is ignored
5 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: a
a) It is ignored
Answer: c
a) (a+b)*(c+d)
b) ab+c*
c) +ab
d) abc+*
Answer: a
a) O(N log N)
b) O(N)
c) O(N2)
d) O(M log N)
Answer: b
25. a) abc*+de*+
b) abc+*de*+
c) a+bc*de+*
d) abc*+(de)*+
Answer: a
26. a) -ab-c
b) ab – c –
6 www.studymaterialz.in
CS8391 DATA STRUCTURES
c) – -abc
d) -ab-c
Answer: b
27. a) abc^/d-
b) ab/cd^-
c) ab/^cd-
d) abcd^/-
Answer: a
28. Which of the following statement is incorrect with respect to infix to postfix conversion algorithm?
b) operator is placed in the stack when the stack operator has lower precedence
Answer: c
29. In infix to postfix conversion algorithm, the operators are associated from?
a) right to left
b) left to right
c) centre to left
d) centre to right
Answer: b
30. a) ab*+cd/
b) ab+*cd/
c) abc*+/d
d) abc+*d/
Answer: d
31. a) ab*cdef/^*g-h+
7 www.studymaterialz.in
CS8391 DATA STRUCTURES
b) abcdef^/*g*h*+
c) abcd*^ed/g*-h*+
d) abc*de^fg/*-*h+
Answer: b
32. a) abc^de-fg+*^*+i-
b) abcde^-fg*+*^h*+i-
c) abcd^e-fgh*+^*+i-
d) ab^-dc*+ef^gh*+i-
Answer: c
33. From the given Expression tree, identify the correct postfix expression from the list of options.
a) ab*cd*+
b) ab*cd-+
c) abcd-*+
Answer: b
34. A linear list of elements in which deletion can be done from one end (front) and insertion can take
place only at the other end (rear) is known as a ?
a) Queue
b) Stack
c) Tree
d) Linked list
Answer: a
35. The data structure required for Breadth First Traversal on a graph is?
a) Stack
b) Array
c) Queue
d) Tree
Answer: c
8 www.studymaterialz.in
CS8391 DATA STRUCTURES
c) Ordered array
d) Linear tree
Answer: a
a) Ring Buffer
b) Square Buffer
c) Rectangle Buffer
d) Curve Buffer
Answer: a
38. If the elements “A”, “B”, “C” and “D” are placed in a queue and are deleted one at a time, in what
order will they be removed?
a) ABCD
b) DCBA
c) DCAB
d) ABDC
Answer: a
39. A data structure in which elements can be inserted or deleted at/from both the ends but not in the
middle is?
a) Queue
b) Circular queue
c) Dequeue
d) Priority queue
Answer: c
40. A normal queue, if implemented using an array of size MAX_SIZE, gets full when
9 www.studymaterialz.in
CS8391 DATA STRUCTURES
a) Rear = MAX_SIZE – 1
c) Front = rear + 1
d) Rear = front
Answer: a
a) Simulation of recursion
Answer: c
a) Ordinary queue
c) Circular queue
d) Priority queue
Answer: b
a) Array
b) List
c) Heap
d) Tree
Answer: d
a) Huffman codes
10 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: c
45. What is the time complexity to insert a node based on key in a priority queue?
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: c
Answer: c
a) A low priority process might have to wait indefinitely for the CPU
b) If the system crashes, the low priority systems may be lost permanently
c) Interrupt handling
d) Indefinite blocking
Answer: c
a) Easy to implement
Answer: d
49. What is the time complexity to insert a node based on position in a priority queue?
11 www.studymaterialz.in
CS8391 DATA STRUCTURES
a) O(nlogn)
b) O(logn)
c) O(n)
d) O(n2)
Answer: c
a) A queue with insert/delete defined for both front and rear ends of the queue
Answer: a
Answer: b
Answer: d
53. a) 10 30 10 15
b) 20 30 40 15
c) 20 30 40 10
d) 10 30 40 15
Answer: d
12 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: b
55. In a circular queue, how do you increment the rear end of the queue?
a) rear++
b) (rear+1) % CAPACITY
c) (rear % CAPACITY)+1
d) rear–
Answer: b
56. What is the term for inserting into a full queue known as?
a) overflow
b) underflow
Answer: a
a) O(logn)
b) O(nlogn)
c) O(n)
d) O(1)
Answer: d
58. a) Dequeue
b) Enqueue
13 www.studymaterialz.in
CS8391 DATA STRUCTURES
Answer: c
b) easier computations
Answer: a
a) O(n)
b) O(nlogn)
c) O(logn)
d) O(1)
Answer: a
61. a) 3 3
b) 3 6
c) 6 6
d) 10 6
Answer: a
14 www.studymaterialz.in