wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Understanding Stacks and Queues Quiz

Total questions: 15

Worksheet time: 12mins

Name
Class
Date
1.

Which data structure is more suitable for scheduling tasks in a printer?

a)

Stack

b)

Queue

c)

Array

d)

Linked List

2.

Which data structure is more suitable for implementing undo functionality in software?

a)

Queue

b)

Stack

c)

Array

d)

Linked List

3.

Which operation is used to remove an item from a stack?

a)

Push

b)

Pop

c)

Peek

d)

Enqueue

4.

Which operation is used to add an item to a queue?

a)

Enqueue

b)

Dequeue

c)

Peek

d)

Pop

5.

What is the main operation of a stack?

a)

First In, First Out (FIFO)

b)

Last In, First Out (LIFO)

c)

Random Access

d)

Last In, Last Out (LILO)

6.

If front=rear ,then the queue is?

a)

empty

b)

full

c)

partially filled

d)

overflowing

7.

What happens if you try to pop an item from an empty stack?

a)

The stack underflows.

b)

The stack overflows.

c)

The stack returns null.

d)

The stack resets to zero.

8.

What is the time complexity of the push operation in a stack implemented using an array?

a)

O(n)

b)

O(log n)

c)

O(1)

d)

O(n^2)

9.

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

a)

2,1,2,1,2

b)

1,2,1,2,2

c)

2,2,1,1,2

d)

1,1,2,2,2

10.

How can an array be used as a stack?

a)

By using the first element as the top

b)

By using the last element as the top

c)

By using the middle element as the top

d)

By using all elements equally as the top

11.

Which operation is used to add an item to a stack?

a)

Pop

b)

Enqueue

c)

Push

d)

Dequeue

12.

How can a linked list be used as a queue?

a)

By adding elements at the head and removing from the tail

b)

By adding elements at the tail and removing from the head

c)

By adding elements at random positions

d)

By removing elements from the middle

13.

What is the main operation of a queue?

a)

Last In, First Out (LIFO)

b)

First In, First Out (FIFO)

c)

Random Access

d)

Priority Access

14.

Which operation is used to remove an item from a queue? Options: Enqueue, Dequeue, Push, Pop

a)

Enqueue

b)

Dequeue

c)

Push

d)

Pop

15.

What is the term for viewing the top item of a stack without removing it?

a)

Peeking

b)

Popping

c)

Pushing

d)

Stacking

Similar Resources on Wayground