

MCQOPTIONS
Saved Bookmarks
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.
101. |
Evaluate Postfix expression from given infix expression.A + B * (C + D) / F + D * E |
A. | AB+CD*F/+D*E |
B. | ABCD+*F/+DE*+ |
C. | ABCD+*/F+DE* |
D. | AB+CD*F/+DE* |
Answer» C. ABCD+*/F+DE* | |
102. |
Jan Lukasiewicz, who suggested two alternative notations to represent an arithmetic expression belonged to which nationality? |
A. | English |
B. | Polish |
C. | German |
D. | Swedish |
Answer» C. German | |
103. |
What will be the postfix expression for following infix expression:b * c + d / e |
A. | b*cde/+ |
B. | bcd*e/+ |
C. | bc*de/+ |
D. | bc*de+/ |
Answer» D. bc*de+/ | |
104. |
If memory for the run-time stack is only 150 cells(words), how big can N be in Factorial(N) before encounterring stack overflow? |
A. | 13 |
B. | 26 |
C. | 31 |
D. | 45 |
Answer» C. 31 | |
105. |
Data Structure required to evaluate infix to postfix is __________. |
A. | Pointer |
B. | Heap |
C. | Stack |
D. | Queue |
Answer» D. Queue | |
106. |
Which of the following is an application of stack? |
A. | finding factorial |
B. | tower of Hanoi |
C. | infix to postfix conversion |
D. | all of the above |
Answer» E. | |
107. |
What will be the postfix expression for following infix expression - A + B * C ^ D |
A. | ABCD*+^ |
B. | ABC+D*^ |
C. | ABCD+*^ |
D. | ABCD^*+ |
Answer» E. | |
108. |
A ……. is a data structure that organizes data similar to a line in the supermarket, where the first one in line is the first one out. |
A. | Queue linked list |
B. | Stacks linked list |
C. | Both of them |
D. | Neither of them |
Answer» B. Stacks linked list | |
109. |
……………. Is a pile in which items are added at one end and removed from the other. |
A. | Stack |
B. | Queue |
C. | List |
D. | None of the above |
Answer» C. List | |
110. |
What is the postfix form of the following prefix expression -A/B*C$DE |
A. | A-BCDE$*/ |
B. | ABC$ED*/- |
C. | ABCDE$*/- |
D. | A-BCDE$*/- |
Answer» D. A-BCDE$*/- | |
111. |
In a computer system, when an __________ expression in an infix notation needs to be evaluated, it is first converted into its postfix notation? |
A. | Algebraic |
B. | Arithmetic |
C. | Trigonometric |
D. | Geometric |
Answer» C. Trigonometric | |
112. |
Identify the data structure which allows deletions at both ends of the list but insertion at only one end. |
A. | Input restricted dequeue |
B. | Output restricted qequeue |
C. | Priority queues |
D. | Stack |
Answer» B. Output restricted qequeue | |
113. |
In conversion from prefix to postfix using stack data-structure, if operators and operands are pushed and popped exactly once, then the run-time complexity is ............ |
A. | Ο(1) |
B. | Ο(n) |
C. | Ο(log n) |
D. | Ο(n^2) |
Answer» C. Ο(log n) | |
114. |
………… is not the operation that can be performed on queue. |
A. | Insertion |
B. | Deletion |
C. | Retrieval |
D. | Traversal |
Answer» E. | |
115. |
Which of the following data structure may give overflow error,even though the current number of element in it is less than its size? |
A. | Simple queue |
B. | Circular queue |
C. | Priority Queues |
D. | None of these |
Answer» C. Priority Queues | |
116. |
User perform following operations on stack of size 5 then -push(1);pop();push(2);push(3);pop();push(2);pop();pop();push(4);pop();pop();push(5);Which of the following is correct statement for stack ? |
A. | Stack Operations will be performed Smoothly |
B. | Underflow Occures |
C. | Overflow Occures |
D. | None of these |
Answer» C. Overflow Occures | |
117. |
Select the appropriate code which reverses a word. |
A. | a |
B. | b |
C. | c |
D. | d |
Answer» C. c | |
118. |
Select the appropriate code which tests for a palindrome. |
A. | a |
B. | b |
C. | c |
D. | d |
Answer» B. b | |
119. |
Select the appropriate code for the recursive Tower of Hanoi problem.(n is the number of disks) |
A. | a |
B. | b |
C. | c |
D. | d |
Answer» B. b | |
120. |
Write a piece of code which returns true if the string contains balanced parenthesis, false otherwise. |
A. | a |
B. | b |
C. | c |
D. | d |
Answer» B. b | |
121. |
For every matching parenthesis, print their indices. |
A. | a |
B. | b |
C. | c |
D. | d |
Answer» B. b | |
122. |
In Computer generally _________ expressions are preferred. |
A. | Postfix |
B. | Infix |
C. | Prefix |
D. | None of the above |
Answer» D. None of the above | |
123. |
The total number of elements in a stack at a given point of time can be calculated from the value of______. |
A. | Overflow |
B. | Top |
C. | Queues |
D. | Underflow |
Answer» C. Queues | |
124. |
Adding element to stack means ___________. |
A. | Placing element at the rear end |
B. | Placing element at the top |
C. | Placing element at the front end |
D. | None of these |
Answer» C. Placing element at the front end | |
125. |
In the stack, If user try to remove element from the empty stack then it called as ___________. |
A. | Empty Collection |
B. | Underflow of Stack |
C. | Garbage Collection |
D. | Overflow of Stack |
Answer» C. Garbage Collection | |
126. |
The prefix of (A+B)*(C-D)/E*F is: |
A. | /+-AB*CD |
B. | /*+-ABCD*EF |
C. | */*+AB-CDEF |
D. | **AB+CD/EF |
Answer» D. **AB+CD/EF | |
127. |
Post fix form ofA + (B * C)is - |
A. | AB * C + |
B. | ABC * + |
C. | AB + C * |
D. | ABC + * |
Answer» C. AB + C * | |
128. |
Which of the following statement is true?i) Using singly linked lists and circular list, it is not possible to traverse the list backwards.ii) To find the predecessor, it is required to traverse the list from the first node in case of singly linked list. |
A. | i-only |
B. | ii-only |
C. | Both i and ii |
D. | None of the above |
Answer» D. None of the above | |
129. |
Queue can be used to implement |
A. | recursion |
B. | radix sort |
C. | quick sort |
D. | depth first search |
Answer» C. quick sort | |
130. |
The prefix form of an infix expression A+B-C*D is |
A. | +AB-*CD |
B. | -+A B C * D |
C. | -+A B * C D |
D. | - + *ABCD |
Answer» D. - + *ABCD | |
131. |
Inserting an item into the stack when stack is not full is called …………. Operation and deletion of item form the stack, when stack is not empty is called ………..operation. |
A. | push, pop |
B. | pop, push |
C. | insert, delete |
D. | delete, insert |
Answer» B. pop, push | |
132. |
A stack works on the principle of____________. |
A. | LIFO |
B. | LAFO |
C. | LIFF |
D. | None of the above |
Answer» B. LAFO | |
133. |
Pushing element in the stack means _____________. |
A. | Sorting element from the stack |
B. | Adding element in the stack |
C. | Removing element from the stack |
D. | Searching element in the stack |
Answer» C. Removing element from the stack | |
134. |
User perform following operations on stack of size 5 then -push(1);pop();push(2);push(3);pop();push(4);pop();pop();push(5);at the end of last operation, total number of elements present in the stack are - |
A. | 3 |
B. | 4 |
C. | 2 |
D. | 1 |
Answer» E. | |
135. |
Which of the following types of expressions does not require precedence rule when evaluated? |
A. | Prefix expression |
B. | More than one of these |
C. | Full parenthesized infix expression |
D. | Partially parenthesized infix expression |
Answer» C. Full parenthesized infix expression | |
136. |
Consider following Scenario -1. The five items : P,Q,R,S and T are inserted into stack A one after other starting from T in reverse order.2. The stack is popped three times and each element is inserted into another stack B.3. Then two elements are deleted from the stack B and pushed back onto the stack A.What are the topmost elements of stack A and Stack B respectively? |
A. | R P |
B. | R Q |
C. | Q R |
D. | Q P |
Answer» E. | |
137. |
Using Pop(S1, Item) Push(S1,Item) Read(Item) Print(Item) the variables S1 represents (stack) and Item are given the input file: A,B,C,D,E,F Which stacks are possible: |
A. | 54 3 F2 D1 B |
B. | 5 4 3 D2 A1 F |
C. | 543 C2 E1 B |
D. | 5 A4 B3 C2 D1 E |
Answer» B. 5 4 3 D2 A1 F | |
138. |
Queue data structure works on |
A. | LIFO |
B. | FIFO |
C. | FILO |
D. | none of the above |
Answer» C. FILO | |
139. |
The result of evaluating the following postfix expression is5, 7, 9, *, +, 4, 9, 3, /, +, - |
A. | 50 |
B. | 65 |
C. | 61 |
D. | 70 |
Answer» D. 70 | |
140. |
Which data structure allows deleting data elements from front and inserting at rear? |
A. | Stacks |
B. | Queues |
C. | Deques |
D. | Binary search tree |
Answer» C. Deques | |
141. |
Stack can be implemented using ___________ and _________. |
A. | Array and Linked List |
B. | Queue and Graphs |
C. | Trees and Linked List |
D. | Array and Graphs |
Answer» B. Queue and Graphs | |
142. |
The data structure required to evaluate a postfix expression is |
A. | queue |
B. | stack |
C. | array |
D. | linked-list |
Answer» C. array | |
143. |
Post fix form of following infix expression is - * + A B - C D |
A. | ABCD + - * |
B. | AB + CD - * |
C. | AB + CD * - |
D. | AB + C - D * |
Answer» C. AB + CD * - | |
144. |
n elements of a Queue are to be reversed using another queue. The number of “ADD” and “REMOVE” operations required to do so is: |
A. | 2*n |
B. | 4*n |
C. | n |
D. | The task cannot be accomplished |
Answer» E. | |
145. |
Stack A has 3 Elements in it Say X,Y and Z with X on top.1. Stack B is empty.2. An Element popped out from Stack A can be printed immediately or pushed to stack B.3. An Element popped out from Stack B can only be printed.In this arrangement, which of the following permutations of X,Y,Z are not possible ? |
A. | Y X Z |
B. | Z X Y |
C. | Y Z X |
D. | Z Y X |
Answer» C. Y Z X | |
146. |
One can convert an infix expression to a postfix expression using a .............. |
A. | Stack |
B. | Queue |
C. | Deque |
D. | None of these |
Answer» B. Queue | |
147. |
In C programming, when we remove an item from bottom of the stack, then − |
A. | The stack will fall down. |
B. | Stack will rearranged items. |
C. | It will convert to LIFO |
D. | This operation is not allowed. |
Answer» C. It will convert to LIFO | |
148. |
Stack is useful for implemeting |
A. | recursion |
B. | depth first search |
C. | both (a) and (b) |
D. | breadth first search |
Answer» D. breadth first search | |
149. |
A data structure where elements can be added or removed at either end but not in the middle is called … |
A. | linked lists |
B. | stacks |
C. | queues |
D. | dequeue |
Answer» E. | |
150. |
Consider these functions:push() : push an element into the stackpop() : pop the top-of-the-stack elementtop() : returns the item stored in top-of-the-stack-nodeWhat will be the output after performing these sequence of operationspush(20);push(4);top();pop();pop();pop();push(5);top(); |
A. | 20 |
B. | 4 |
C. | stack underflow |
D. | 5 |
Answer» E. | |