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

MCQ (Stack & Queue)

The document is an assignment focused on Stack and Queue data structures, consisting of multiple-choice questions that test knowledge on their implementations, operations, and properties. It covers various topics such as the disadvantages of different queue implementations, conditions for full and underflow states, and operations on stacks and queues. The assignment includes questions about postfix and prefix expressions, recursion, and specific operations on stacks and queues.

Uploaded by

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

MCQ (Stack & Queue)

The document is an assignment focused on Stack and Queue data structures, consisting of multiple-choice questions that test knowledge on their implementations, operations, and properties. It covers various topics such as the disadvantages of different queue implementations, conditions for full and underflow states, and operations on stacks and queues. The assignment includes questions about postfix and prefix expressions, recursion, and specific operations on stacks and queues.

Uploaded by

Ritesh Kumar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

Assignment-3 (Stack & Queue)


* Indicates required question

1. Email *

2. What is the major disadvantage of using a queue which is implemented with * 1 point

a linked list, as compared to a circular array-based queue?

Mark only one oval.

Higher memory overhead

Slower access time

Difficulty in implementing front and rear pointers

Limited queue size

3. What is the condition for a queue to be considered full when implemented * 1 point

using an array with size N?

Mark only one oval.

When the front equals the rear

When the rear is at index N-1

When the number of elements exceeds N

When the front and rear pointers overlap

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 1/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

4. Assume that a queue implemented using two stacks. How many times will * 1 point

an element be pushed and popped in total when performing a sequence of


enqueue and dequeue operations?

Mark only one oval.

Each element is pushed and popped once

Each element is pushed twice and popped twice

Each element is pushed once and popped twice

Each element is pushed twice and popped once

5. If in a circular queue, the front pointer is at index 0 and the rear pointer is at * 1 point

index N-1, and an element is dequeued, where should the rear pointer point
to?

Mark only one oval.

Index 0

Index N-2

Index N

It remains at index N-1

6. Assume that a queue is being used to model the process of printing jobs in * 1 point

a printer. If a job with higher priority arrives at the queue, what type of queue
will be best suited for this scenario?

Mark only one oval.

Simple Queue

Circular Queue

Priority Queue

Double-ended Queue

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 2/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

7. Consider the following sequence of operations on an empty queue * 1 point


implemented with an array: Enqueue(A), Enqueue(B), Dequeue(),
Enqueue(C). What will be the state of the queue at the end of these
operations?

Mark only one oval.

[A, B, C]

[B, C]

[A, C]

[C]

8. Assume that a queue can hold up to N elements, and the queue is * 1 point

implemented using a circular array. What will happen if we insert one more
element when the queue is full?

Mark only one oval.

The new element will overwrite the oldest element

The new element will be discarded

The program will raise an error

The queue will resize itself automatically

9. If a queue is implemented using an array MAX_QUEUE, then the condition of 1 point


UNDERFLOW will occur if

Mark only one oval.

FRONT=NULL

REAR=NULL

FRONT=MAX_QUEUE

REAR=MAX_QUEUE

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 3/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

10. A deque will look like ___________ after 1 point


InsertFront(10);InsertFront(20);InsertRear(30);DeleteFront();InsertRear(40);I
nsertRear(10);DeleteRear();InsertRear(15);

Mark only one oval.

10 30 10 15

20 30 40 15

20 30 40 10

10 30 40 15

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

Mark only one oval.

12. Which of the following is true about linked list implementation of stack? 1 point

Mark only one oval.

In push operation, if new nodes are inserted at the beginning of linked list, then in
pop operation, nodes must be removed from end.

In push operation, if new nodes are inserted at the end, then in pop operation,
nodes must be removed from the beginning.

Both of the above

None of the above

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 4/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

13. Stack is a 1 point

Mark only one oval.

LIFO

FIFO

FILO

LILO

14. Which function places an element on the stack? 1 point

Mark only one oval.

POP

PUSH

PEEK

None of the above

15. Disks piled up one above the other represent a 1 point

Mark only one oval.

Stack

Queue

Linked List

Array

16. Reverse Polish notation is the other name of 1 point

Mark only one oval.

Infix Expression

Prefix Expression

Postfix Expression

Algebraic Expression

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 5/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

17. Consider the following pseudocode that uses a stack. What is output for input 1 point
"Stack"?

Mark only one oval.

kcatS

StackStack

Stack

None of above

18. A single array A[1..MAXSIZE] is used to implement two stacks. The two 1 point
stacks grow from opposite ends of the array. Variables top1 and top2 (top1<
top 2) point to the location of the topmost element in each of the stacks. If
the space is to be used efficiently, the condition for “stack full” is

Mark only one oval.

(top1 = MAXSIZE/2) and (top2 = MAXSIZE/2+1)

top1 + top2 = MAXSIZE

(top1= MAXSIZE/2) or (top2 = MAXSIZE)

top1= top2 -1

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 6/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

19. The postfix expression corresponding to the infix expression a + b × c - d ^ e 1 point


^ f is

Mark only one oval.

abc × + def ^ ^ -

abc × + de ^ f ^ -

ab + c × d - e ^ f ^

- + a × bc ^ ^ def

20. The prefix form of an infix expression p + q - r * t is? 1 point

Mark only one oval.

+ pq - *rt

- +pqr * t

- + * pqrt

- +pq * rt

21. Consider the following operation performed on a stack of size 5. 1 point


Push(1);Pop();Push(2);Push(3);Pop();Push(4);Pop();Pop();Push(5);
After the completion of all operation, the no of element present on stack are

Mark only one oval.

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 7/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

22. The type of expression in which operator succeeds its operands is? 1 point

Mark only one oval.

Infix Expression

Prefix Expression

Postfix Expression

Both Prefix and Postfix Expressions

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

Mark only one oval.

-/*^ACBDE

-ABCD*^DE

-A/B*C^DE

-A/BC*^DE

24. What is the value of the postfix expression 6 3 2 4 + – *? 1 point

Mark only one oval.

40

74

-18

25. User push 1 element in the stack having already five elements and having 1 point

stack size as 5 then stack becomes ___________

Mark only one oval.

Crash

User Flow

Overflow

Underflow

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 8/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

26. In stacks, the possibility to do insertion and deletion is ____ 1 point

Mark only one oval.

At one end only

at both ends

Both A & B.

None

27. From the following which are static and dynamic representations of stacks? 1 point

Mark only one oval.

Arrays – Static, Linked lists – Dynamic.

Linked lists – Static, Arrays – Dynamic.

Queues –Dynamic ,Arrays – Static

None of the mentioned.

28. What is the number of moves required to solve Tower of Hanoi problem for k 1 point

disks?

Mark only one oval.

2k – 1

2k + 1

2^k-1

2^k+1

29. Postfix operation does not follow the rules of operator precedence. 1 point

Mark only one oval.

True

False

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 9/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

30. Underflow occurs when TOP = MAX-1 1 point

Mark only one oval.

True

False

31. Using a recursive function takes more memory and time to execute. 1 point

Mark only one oval.

True

False

32. The recursive function fun(int n){if (n==1) return 1;else return n*fun(n-1);} will 1 point

Mark only one oval.

return n term of Fibonacci series

check the n for prime no

return the factorial of n

None of the above

33. Consider a stack having 3 nodes with value A,B,C and C is at the TOP while 1 point
A is the first inserted node. What will be the instance of STACK after
POP(),PUSH(A),PUSH(B),POP(),PUSH(C)

Mark only one oval.

ABAC->TOP

ABCABC->TOP

BCCB->TOP

ACAB->TOP

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 10/11
1/21/25, 1:50 PM Assignment-3 (Stack & Queue)

34. Consider a stack A B C D->TOP. The top is at D. Which sequence of 1 point

operations is required to get the stack Z A B C D->TOP

Mark only one oval.

push(pop()), push(Z),push(pop())

push(Z)

push(pop()),push(pop()),push(Z)

None of the above

35. The most appropriate data structure to find if the given word is a palindrome 1 point
or not

Mark only one oval.

queue

tree

stack

graph

36. What are the set of functions that are to be executed on a stack to get RJIT 1 point

as output

Mark only one oval.

pop(R), pop(J), pop (I), pop (T)

push(R), push(J), pop(I), push(T)

push(R), push(S), pop(), push(J), push(X), pop(), push(I), pop(), push(T),


push(Z),pop()

None of the above

This content is neither created nor endorsed by Google.

Forms

https://docs.google.com/forms/d/1lcmNYl0mHXvASq6P_egubNz6Bt_tLcvmFHYHF3JT_EQ/edit 11/11

You might also like