144
83.2k
Chapter:

40+ Linear Data Structures -Stacks and Queues Solved MCQs

in Data Structures (DS)

These multiple-choice questions (MCQs) are designed to enhance your knowledge and understanding in the following areas: Computer Science Engineering (CSE) , Information Technology Engineering (IT) , Bachelor of Science in Computer Science FY (BSc CS) , Bachelor of Science in Information Technology FY (BSc IT) , Bachelor of Computer Applications (BCA) .

Chapters

Chapter: Linear Data Structures -Stacks and Queues
1.

Process of inserting an element in stack is called

A. Create
B. Push
C. Evaluation
D. Pop
Answer» B. Push
2.

Process of removing an element from stack is called

A. Create
B. Push
C. Evaluation
D. Pop
Answer» D. Pop
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. Underflow
4.

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

A. Overflow
B. Crash
C. Underflow
D. User flow
Answer» A. Overflow
5.

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» D. There is a Sequential entry that is one by one
6.

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» D. Data Transfer between two asynchronous process
7.

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
C. none
D. none
Answer» B. 2
8.

What is the value of the postfix expression 6 3 2 4 + – *?

A. 1
B. 40
C. 74
D. -18
Answer» D. -18
9.

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» C. AB + CD* E – *F *G /
10.

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

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

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. Stack
12.

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. Stack
13.

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

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

Which data structure is needed to convert infix notation to postfix notation?

A. Branch
B. Tree
C. Queue
D. Stack
Answer» D. Stack
15.

The prefix form of A-B/ (C * D ^ E) is?

A. -/*^ACBDE
B. -ABCD*^DE
C. -A/B*C^DE
D. -A/BC*^DE
Answer» C. -A/B*C^DE
16.

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

A. X
B. X+S
C. S
D. none
Answer» A. X
17.

The prefix form of an infix expression (p + q) – (r * t) is?

A. + pq – *rt
B. – +pqr * t
C. – +pq * rt
D. – + * pqrt
Answer» C. – +pq * rt
18.

Which data structure is used for implementing recursion?

A. Queue
B. Stack
C. Array
D. List
Answer» B. Stack
19.

When an operand is read, which of the following is done?

A. It is placed on to the output
B. It is placed in operator stack
C. It is ignored
D. Operator stack is emptied
Answer» A. It is placed on to the output
20.

What should be done when a left parenthesis ‘(‘ is encountered?

A. It is ignored
B. It is placed in the output
C. It is placed in the operator stack
D. The contents of the operator stack is emptied
Answer» C. It is placed in the operator stack
21.

Which of the following is an infix expression?

A. (a+b)*(c+d)
B. ab+c*
C. +ab
D. abc+*
Answer» A. (a+b)*(c+d)
22.

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» B. O(N)
23.

Which of the following statement is incorrect with respect to infix to postfix conversion algorithm?

A. operand is always placed in the output
B. operator is placed in the stack when the stack operator has lower precedence
C. parenthesis are included in the output
D. higher and equal priority operators follow the same condition
Answer» C. parenthesis are included in the output
24.

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

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. Queue
26.

The data structure required for Breadth First Traversal on a graph is?

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

A queue follows

A. FIFO (First In First Out) principle
B. LIFO (Last In First Out) principle
C. Ordered array
D. Linear tree
Answer» A. FIFO (First In First Out) principle
28.

Circular Queue is also known as

A. Ring Buffer
B. Square Buffer
C. Rectangle Buffer
D. Curve Buffer
Answer» A. Ring Buffer
29.

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. ABCD
30.

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. Dequeue
31.

A normal queue, if implemented using an array of size MAX_SIZE, gets full when

A. Rear = MAX_SIZE – 1
B. Front = (rear + 1)mod MAX_SIZE
C. Front = rear + 1
D. Rear = front
Answer» A. Rear = MAX_SIZE – 1
32.

Queues serve major role in

A. Simulation of recursion
B. Simulation of arbitrary linked list
C. Simulation of limited resource allocation
D. Simulation of heap sort
Answer» C. Simulation of limited resource allocation
33.

Which of the following is not the type of queue?

A. Ordinary queue
B. Single ended queue
C. Circular queue
D. Priority queue
Answer» B. Single ended queue
34.

With what data structure can a priority queue be implemented?

A. Array
B. List
C. Heap
D. Tree
Answer» D. Tree
35.

Which of the following is not an application of priority queue?

A. Huffman codes
B. Interrupt handling in operating system
C. Undo operation in text editors
D. Bayesian spam filter
Answer» C. Undo operation in text editors
36.

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

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» C. Interrupt handling
38.

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

What is the time complexity to insert a node based on position in a priority queue?

A. O(nlogn)
B. O(logn)
C. O(n)
D. O(n2)
Answer» C. O(n)
40.

What is a dequeue?

A. A queue with insert/delete defined for both front and rear ends of the queue
B. A queue implemented with a doubly linked list
C. A queue implemented with both singly and doubly linked lists
D. A queue with insert/delete defined for front side of the queue
Answer» A. A queue with insert/delete defined for both front and rear ends of the queue
41.

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» D. To avoid collision in hash tables
42.

Which of the following properties is associated with a queue?

A. First In Last Out
B. First In First Out
C. Last In First Out
D. Last In Last Out
Answer» B. First In First Out
43.

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

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» A. overflow
45.

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» A. effective usage of memory
46.

What is the space complexity of a linear queue having n elements?

A. O(n)
B. O(nlogn)
C. O(logn)
D. O(1)
Answer» A. O(n)

Done Studing? Take A Test.

Great job completing your study session! Now it's time to put your knowledge to the test. Challenge yourself, see how much you've learned, and identify areas for improvement. Don’t worry, this is all part of the journey to mastery. Ready for the next step? Take a quiz to solidify what you've just studied.