Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Stack

Total questions: 20

Worksheet time: 23mins

Name
Class
Date
1.

Accessing top element in stack is constant time operation.

a)

TRUE

b)

FALSE

2.

Only top element can be accessed in stack

a)

TRUE

b)

FALSE

3.

Stacks have LIFO ordering

a)

TRUE

b)

FALSE

4.

The postfix form of the expression (A+ B)*(C*D- E)*F / G is?

a)

AB + CDE * - * F *G /

b)

AB+ CD*E - FG /**

c)

AB + CD* E - F **G /

d)

AB + CD* E - *F *G /

5.

Act of adding values into a stack is called

a)

Popping

b)

Polling

c)

Pushing

d)

None

6.

The prefix form of A-B/ (C * D ⋀ E) is?

a)

-/*⋀ACBDE

b)

-ABCD*⋀DE

c)

-A/B*C⋀DE

d)

-A/BC*⋀DE

7.

The postfix form of A*B+C/D is?

a)

*AB/CD+

b)

AB*CD/+

c)

A*BC+/D

d)

ABCD+/*

8.

Which of the following statement(s) about stack data structure is/are NOT correct?

a)

Stack data structure can be implemented using linked list

b)

New node can only be added at the top of the stack

c)

Stack is the FIFO data structure

d)

The last node at the bottom of the stack has a NULL link

9.

If the elements “A”, “B”, “C” and “D” are placed in a stack and are deleted one at a time, in what order will they be removed?

a)

ABCD

b)

DCBA

c)

DCAB

d)

ABDC

10.

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);


After the completion of all operation, the no of element present on stack are

a)

1

b)

2

c)

3

d)

4

11.

Which of the following application generally use a stack?

a)

Parenthesis balancing program

b)

Syntax analyzer in compiler

c)

Keeping track of local variables at run time

d)

All of the above

12.

In order to keep track of current topmost element of the stack we need to maintain one variable.

a)

Yes

b)

No

c)

Both Yes and No

d)

None of the answer

13.

Select a real life situation implement stack

a)

All of the answers

b)

The cars a garage the first car in will be the last car out of the garage

c)

The batteries in a flashlight

d)

The person wear bangles

14.

What is the value of the postfix expression 6 3 2 4 + – *

a)

1

b)

40

c)

74

d)

-18

15.

What will be the postfix form of the above expression -

(A+B)∗(C∗D-E)∗F/G

a)

None of these

b)

A B + C D ∗ E − F G ∗ / ∗

c)

A B + C D E ∗ − F G / ∗ ∗

d)

A B + C D ∗ E − F G / ∗ ∗

16.

Suppose implementation supports an instruction REVERSE, which reverses the order of elements on the stack, in addition to the PUSH and POP instructions. Which one of the following statements is TRUE with respect to this modified stack?

a)

A queue cannot be implemented using this stack.

b)

A queue can be implemented where ENQUEUE takes a single instruction and DEQUEUE takes a sequence of two instructions.

c)

A queue can be implemented where ENQUEUE takes a sequence of three instructions and DEQUEUE takes a single instruction.

d)

A queue can be implemented where both ENQUEUE and DEQUEUE take a single instruction each.

17.

Following is C like pseudo code of a function that takes a number as an argument, and uses a stack S to do processing.


What does the above function do in general?

a)

Prints binary representation of n in reverse order

b)

Prints binary representation of n

c)

Prints the value of Logn

d)

Prints the value of Logn in reverse order

18.

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,2,1,1,2

b)

2,2,1,2,2

c)

2,1,2,2,1

d)

2,1,2,2,2

19.

Which of the following is not an inherent application of stack?

a)

Implementation of recursion

b)

Evaluation of a postfix expression

c)

Job scheduling

d)

Reverse a string

20.

Entries in a stack are “ordered”. What is the meaning of this statement?

a)

A collection of stacks is sortable

b)

Stack entries may be compared with the ‘<‘ operation

c)

The entries are stored in a linked list

d)

There is a Sequential entry that is one by one