Explore topic-wise MCQs in Data Structures and Algorithms.

This section includes 161 Mcqs, each offering curated multiple-choice questions to sharpen your Data Structures and Algorithms knowledge and support exam preparation. Choose a topic below to get started.

51.

Stack cannot be used to

A. Evaluation of Expression in Postfix form
B. Reversing String
C. Implementation of Recursion
D. Allocating Resources and Scheduling
Answer» E.
52.

The prefix form of an infix expression p + q − r t* is

A. + pq − rt
B. − +pqr t*
C. − +pq*rt
D. - +*pqrt
Answer» D. - +*pqrt
53.

What is the result of the following operation:Top (Push (S, X))

A. X
B.
C. S
D. None of these
Answer» B.
54.

What is the postfix form of the following prefix:*+ab–cd

A. ab+cd–*
B. abc+*–
C. ab+*cd–
D. ab+*cd–
Answer» B. abc+*–
55.

The postfix form of A*B+C/D is

A. *AB/CD+
B. AB*CD/+
C. A*BC+/D
D. ABCD+/*
Answer» C. A*BC+/D
56.

Let the following circular queue can accommodate maximum six elements with the following datafront = 2 rear = 4queue = _______, L, M, N, ___, ___ What will happen after ADD O operation takes place?

A. front = 2 rear = 5 queue = ______, L, M, N, O, ___
B. front = 3 rear = 5 queue = L, M, N, O, ___
C. front = 3 rear = 4 queue = ______; L, M, N, O, ___
D. front = 2 rear = 4 queue = L, M, N, O, ___
Answer» B. front = 3 rear = 5 queue = L, M, N, O, ___
57.

The data structure required to check whether an expression contains balanced parenthesis is

A. Stack
B. Queue
C. Tree
D. Array
Answer» B. Queue
58.

The initial configuration of a queue is a, b, c, d, ('a' is in the front end). To get the configuration d, c, b, a, one needs a minimum of

A. 2 deletions and 3 additions
B. 3 deletion and 2 additions
C. 3 deletions and 3 additions
D. 3 deletions and 4 additions
Answer» D. 3 deletions and 4 additions
59.

The postfix form of A ^ B * C - D + E/ F/ (G + H)

A. AB^C*D-EF/GH+/+
B. AB^CD-EP/GH+/+*
C. ABCDEFGH+//+-*^
D. AB^D +EFGH +//*+
Answer» B. AB^CD-EP/GH+/+*
60.

Number of "ADD" and "REMOVE" operations required to access n/2th elements of a queue of "n" elements so that the original queue remain the same after the access is (take help of another queue.)

A. 2*n
B. 4*n
C. 8*n
D. 8*n-1
Answer» C. 8*n
61.

In stack terminology, the __________operations are known as push and pop operations respectively.

A. Delete
B. Insert
C. Both (a) and (b)
D. None of the above
Answer» C. Both (a) and (b)
62.

The minimum number of multiplications and additions required to evaluate the polynomialP = 4x3+3x2-15x+45 is

A. 6 & 3
B. 4 & 2
C. 3 & 3
D. 8 & 3
Answer» D. 8 & 3
63.

The postfix form of the expression (A + B)∗(C∗D − E)∗F / G is

A. AB + CD∗E − FG /∗∗
B. / AB + CD ∗ E − F ∗∗G /
C. AB + CD ∗ E − ∗F ∗ G /
D. AB + CDE ∗ − ∗ F ∗ G /
Answer» B. / AB + CD ∗ E − F ∗∗G /
64.

Stack A has the entries a,b,c(with a on top). Stack B is empty.An entry popped out of stack A can be printed immediately or pushed to stack B.An entry popped out of the stack B can only be printed. In this arrangement, which of the following permutations of a,b,c are not possible?

A. b c a
B. b a c
C. c b a
D. c a b
Answer» E.
65.

The term "push" and "pop" is related to the

A. array
B. lists
C. stacks
D. all of above
Answer» D. all of above
66.

‘Array implementation of Stack is not dynamic’, which of the following statements supports this argument?

A. space allocation for array is fixed and cannot be changed during run-time
B. user unable to give the input for stack operations
C. a runtime exception halts execution
D. all of the mentioned
Answer» B. user unable to give the input for stack operations
67.

Post fix form of -(A + B) * C

A. AB + C*
B. ABC * +
C. ABC + *
D. AB * C +
Answer» B. ABC * +
68.

Following sequence of operations is performed on a stack push(1),push(2),pop, push(1),push(2)pop,pop,pop,push(2),pop.The sequence of poped out values are

A. 2,1,2,2,1
B. 2,1,2,2,2
C. 2,2,1,1,2
D. 2,2,1,2,2
Answer» D. 2,2,1,2,2
69.

A common example of a queue is people waiting in line at a__________.

A. Bus stop
B. Movie hall
C. Shopping mall
D. None of the above
Answer» B. Movie hall
70.

The result of evaluating the postfix expression 5, 4, 6, +, *, 4, 9, 3, /, +, * is

A. 600
B. 350
C. 650
D. 588
Answer» C. 650
71.

What will be the value of top, if there is a size of stack STACK_SIZE is 5

A. 5
B. 6
C. 4
D. None of the above
Answer» D. None of the above
72.

When does top value of the stack changes?

A. Before deletion
B. While checking underflow
C. At the time of deletion
D. After deletion
Answer» E.
73.

In a queue, the initial values of front pointer f rare pointer r should be …….. and ……….. respectively.

A. 0 and 1
B. 0 and -1
C. -1 and 0
D. 1 and 0
Answer» C. -1 and 0
74.

An item that is read as input can be either pushed to a stack and later popped and printed, or printed directly. Which of the following will be the output if the input is the sequence of items 1, 2, 3

A. 1, 5, 2, 3, 4
B. 3, 4, 5, 2, 1
C. 3, 4, 5, 1, 2
D. 5, 4, 3, 1, 2
Answer» C. 3, 4, 5, 1, 2
75.

In a priority queue, insertion and deletion takes place at ………………

A. front, rear end
B. only at rear end
C. only at front end
D. any position
Answer» E.
76.

A ……………….. is a linear list in which insertions and deletions are made to from either end of the structure.

A. circular queue
B. random of queue
C. priority
D. dequeue
Answer» E.
77.

Which is/are the application(s) of stack

A. Function calls
B. Large number Arithmetic
C. Evaluation of arithmetic expressions
D. All of the above
Answer» E.
78.

When a stack is organized as an array, a variable named Top is used to point to the top element of the stack. Initially, the value of Top is set to_______to indicate an empty stack.

A. -1
B. 0
C. 1
D. x
Answer» B. 0
79.

The process of accessing data stored in a serial access memory is similar to manipulating data on a

A. heap
B. queue
C. stack
D. binary tree
Answer» D. binary tree
80.

What are the sequence of popped out values if the sequence of operations - push(1), push(2), pop, push(1), push(2), pop, pop, pop, push(2), pop are performed on a stack.

A. 2, 2, 1, 1, 2
B. 2, 2, 1, 2, 2
C. 2, 1, 2, 2, 1
D. 2, 1, 2, 2, 2
Answer» B. 2, 2, 1, 2, 2
81.

What is the postfix form of the following prefix expression -A/B*C$DE ?

A. ABCDE$*/-
B. A-BCDE$*/-
C. ABC$ED*/-
D. A-BCDE$*/
Answer» B. A-BCDE$*/-
82.

The equivalent prefix expression for the following infix expression (A+B)-(C+D*E)/F*G is

A. -+AB*/+C*DEFG
B. /-+AB*+C*DEFG
C. -/+AB*+CDE*FG
D. -+AB*/+CDE*FG
Answer» B. /-+AB*+C*DEFG
83.

The postifx expression for the infix expression A + B* (C+D) / F + D*E is

A. AB+CD + *F/ D+E*
B. A + *BCD/ F* DE ++
C. A*B + CD / F* DE ++
D. ABCD + *F / + DE* +
Answer» E.
84.

Stack in Data Structure is ___________.

A. FIFO
B. LILO
C. LIFO
D. None of these
Answer» D. None of these
85.

One can determine whether an infix expression has balanced parenthesis or not by using .............

A. Array
B. Queue
C. Stack
D. Tree
Answer» D. Tree
86.

__________is a linear data structure in which an element can be added or removed only at one end.

A. Stack
B. Queue
C. String
D. Linked List
Answer» B. Queue
87.

Stacks cannot be used to

A. implement recursion
B. evaluate an arithmetic expression  in postfix form
C. allocate resources (like CPU) by the operating system
D. convert a given arithmetic expression in infix form to its equivalent postfix form
Answer» D. convert a given arithmetic expression in infix form to its equivalent postfix form
88.

Well formed parenthesis can be checked using following data structure ?

A. Queue
B. Stack
C. Hash Map
D. List
Answer» C. Hash Map
89.

In eveluating the arithmetic expression 2*3-(4+5),using stacks to evaluate its equivalent postfix form, which of the following stack configuration is not possible?

A. 4 6
B. 9 6
C. 5 4 6
D. 9 3 2
Answer» E.
90.

In a circular queue the value of r will be ..

A. r=r+1
B. r=(r+1)% [QUEUE_SIZE – 1]
C. r=(r+1)% QUEUE_SIZE
D. r=(r-1)% QUEUE_SIZE
Answer» D. r=(r-1)% QUEUE_SIZE
91.

Which data structure is used in breadth first search of a graph to hold nodes?

A. Stack
B. queue
C. Tree
D. Array
Answer» C. Tree
92.

Stack is also called as

A. Last in first out
B. First in last out
C. Last in last out
D. First in first out
Answer» B. First in last out
93.

Convert the following infix expression to postfix expression -B * C - C + D / A / ( E + E )

A. B C * C - D A / E E + / +
B. B C C * - D A / E E + / +
C. B C C - * D A / E E + / +
D. B C C - * D / A E E + / +
Answer» B. B C C * - D A / E E + / +
94.

Which data structure allows deleting data elements from and inserting at rear?

A. Stacks
B. Queues
C. Dequeues
D. Binary search tree
Answer» C. Dequeues
95.

Which of the following uses FIFO method

A. Queue
B. Stack
C. Hash Table
D. Binary Search Tree
Answer» B. Stack
96.

What data structure can be used to check if a syntax has balanced parenthesis ?

A. queue
B. tree
C. list
D. stack
Answer» E.
97.

Convert the following infix expression to postfix expression -A / B ^ C + D * E - A * C

A. A B C / ^ D E * + A C * -
B. A B C ^ / D * E + A C * -
C. A B C ^ / D E * + A * C -
D. A B C ^ / D E * + A C * -
Answer» E.
98.

Which of the following is an example of Postfix expression ?

A. (A + B) / C
B. A B C ^ / D E * + A C * -
C. * + A B C
D. None of these
Answer» C. * + A B C
99.

Expression in which Operator is written after Operand is called as ________.

A. Infix Expression
B. Postfix Expression
C. Prefix Expression
D. None of the above
Answer» C. Prefix Expression
100.

What will be the postfix expression for following infix expression - A / B ^ C - D

A. A B / ^ C D -
B. A B ^ / C D -
C. A B C ^ / D -
D. A B C / ^ D -
Answer» D. A B C / ^ D -