wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Data Structure (Stack) quiz - 4

Total questions: 10

Worksheet time: 9mins

Name
Class
Date
1.

The result evaluating the postfix expression

10 5 + 60 6 / * 8 –

is

a)

284

b)

213

c)

142

d)

71

2.

Consider the following operations performed on a stack of size 5 : Push (a); Pop() ; Push(b); Push(c); Pop(); Push(d); Pop();Pop(); Push (e) Which of the following statements is correct?

a)

Underflow occurs

b)

Stack operations are performed smoothly

c)

Overflow occurs

d)

None of these

3.

Postfix of

(A + B^ D) / (E – F) + G

is

a)

ABD + ^EF – / G+

b)

ABD + ^EF / – G+

c)

ABD^ + EF – / G+

d)

ABD^ + EF / – G+

4.

What is the main principle behind the stack data structure?

a)

FIFO (First In, First Out)

b)

LIFO (Last In, First Out)

c)

Priority Queue

d)

None of these

5.

What is the time complexity for the push and pop operations in a stack

a)

O(n)

b)

O(n^2)

c)

O(1)

d)

O(logn)

6.

In which real-world scenario can a stack be applied?

a)

Undo functionality in text editors

b)

Browser history navigation

c)

Both of these

d)

None of these

7.

What would happen if we use a stack with a fixed size and try to perform a push operation when the stack is full?

a)

The new element is ignored

b)

Underflow error

c)

The stack automatically expands

d)

Overflow error

8.

Which of the following is not an application of stack?

a)

Recursion

b)

Tower of Hanoi

c)

Undo operation in text editor

d)

Task scheduling

e)

Postfix expression evaluation

9.

What is the time complexity to empty the stack of size N?

a)

O(1)

b)

O(N)

c)

O(n^2)

d)

O(logn)

10.

What is the output of evaluation of

+, -, *, 3, 2, /, 8, 4, 1

a)

11

b)

12

c)

5

d)

4