Search Header Logo
Stack and Queue

Stack and Queue

Assessment

Presentation

Computers

11th Grade

Practice Problem

Medium

Created by

Dineshkumar Prabhuraj

Used 2+ times

FREE Resource

20 Slides • 22 Questions

1

media

2

media

3

Multiple Choice

Which operation removes the top element from a stack?

1

push

2

pop

3

peek

4

insert

4

media

5

Multiple Choice

Which of the following operations does NOT remove an element from the stack?

1

push()

2

pop()

3

peek()

4

isEmpty()

6

media

7

web page not embeddable

Array Stack Visualization

You can open this webpage in a new tab.

8

web page not embeddable

Linked List Stack Visualization

You can open this webpage in a new tab.

9

Open Ended

Explain how the Last-In-First-Out (LIFO) principle is demonstrated in the stack visualisation example.

10

media

11

Multiple Choice

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

Push(1);

Pop();

Push(2);

Push(3);

Pop();

Push(4);

Pop();

Pop();

Push(5);

1

4

2

3

3

2

4

1

12

Multiple Select

Select all the functions from the Python stack implementation that check the status of the stack rather than modify it.

1

is_empty()

2

push(item)

3

pop()

4

peek()

13

media

14

Multiple Choice

Which of the following is NOT a typical application of stacks?

1

Browser history

2

Interrupt handling

3

Recursion

4

Sorting a list

15

Fill in the Blanks

16

media

17

Open Ended

Describe the sequence of stack contents after the following operations: push(2), push(3), push(4), pop(), push(5), pop().

18

media

19

media

20

Multiple Choice

Which principle does a queue data structure follow?

1

FIFO (First In First Out)

2

LIFO (Last In First Out)

3

Random Access

4

Priority Based

21

media

22

Open Ended

Explain how the enqueue and dequeue operations work in a queue, using the diagrams provided.

23

media

24

25

Multiple Choice

Which of the following functions in the given Python code checks if the queue is empty?

1

enqueue

2

dequeue

3

is_empty

4

queue_str

26

media

27

Multiple Choice

In a Queue, what operation is performed to add a new element?

1

Enqueue

2

Dequeue

3

Push

4

Pop

28

Multiple Choice

Identify two real-world scenarios where queues are used, as mentioned in the slide.

1

Printer queues and keyboard queue

2

Stack memory and recursion

3

Sorting algorithms and searching

4

File systems and databases

29

Multiple Choice

Which of the following operations is not typically associated with a queue?

1

Enqueue

2

Dequeue

3

Peek

4

Pop

30

Multiple Choice

What is the index of the first element in a list/array?

1

1

2

-1

3

2

4

0

31

media

32

Fill in the Blanks

33

media

34

media

35

Multiple Choice

Which of the following statements is true about arrays and stacks/queues?

1

Arrays are dynamic data structures and can change size.

2

Stacks and queues are static data structures and cannot change size.

3

Arrays are static data structures and cannot change size, while stacks and queues are dynamic data structures and can change size.

4

Stacks and queues cannot be implemented using arrays.

36

media

37

media

38

Multiple Select

Which of the following are common applications of queues?

1

Function calls in compilers

2

Interrupt handling in real-time systems

3

Simulating recursion in programs

4

Serving requests of a shared resource like a printer

39

Open Ended

How would you describe the process of adding and removing elements in a stack, and how does this relate to the concept of 'top' in the stack data structure?

40

Multiple Choice

In a stack, if a user tries to remove an element from empty stack it is called _________

1

Underflow

2

Empty collection

3

Overflow

4

Garbage Collection

41

Multiple Choice

What is the main difference between the LIFO and FIFO principles when working with stacks and queues?

1

LIFO removes the oldest element first, FIFO removes the newest element first

2

LIFO removes the newest element first, FIFO removes the oldest element first

3

LIFO and FIFO both remove elements randomly

4

LIFO and FIFO are only used in sorting algorithms

42

Open Ended

Why is understanding the principles of stacks and queues important in computer science and programming?

media

Show answer

Auto Play

Slide 1 / 42

SLIDE