NEW
Font size
WorksheetsUnderstanding Stacks and Queues Quiz
Total questions: 15
Worksheet time: 12mins
Which data structure is more suitable for scheduling tasks in a printer?
Stack
Queue
Array
Linked List
Which data structure is more suitable for implementing undo functionality in software?
Queue
Stack
Array
Linked List
Which operation is used to remove an item from a stack?
Push
Pop
Peek
Enqueue
Which operation is used to add an item to a queue?
Enqueue
Dequeue
Peek
Pop
What is the main operation of a stack?
First In, First Out (FIFO)
Last In, First Out (LIFO)
Random Access
Last In, Last Out (LILO)
If front=rear ,then the queue is?
empty
full
partially filled
overflowing
What happens if you try to pop an item from an empty stack?
The stack underflows.
The stack overflows.
The stack returns null.
The stack resets to zero.
What is the time complexity of the push operation in a stack implemented using an array?
O(n)
O(log n)
O(1)
O(n^2)
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, the sequence of popped out values
2,1,2,1,2
1,2,1,2,2
2,2,1,1,2
1,1,2,2,2
How can an array be used as a stack?
By using the first element as the top
By using the last element as the top
By using the middle element as the top
By using all elements equally as the top
Which operation is used to add an item to a stack?
Pop
Enqueue
Push
Dequeue
How can a linked list be used as a queue?
By adding elements at the head and removing from the tail
By adding elements at the tail and removing from the head
By adding elements at random positions
By removing elements from the middle
What is the main operation of a queue?
Last In, First Out (LIFO)
First In, First Out (FIFO)
Random Access
Priority Access
Which operation is used to remove an item from a queue? Options: Enqueue, Dequeue, Push, Pop
Enqueue
Dequeue
Push
Pop
What is the term for viewing the top item of a stack without removing it?
Peeking
Popping
Pushing
Stacking
