wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Topic 3 (Stacks)

Total questions: 20

Worksheet time: 40mins

Name
Class
Date
1.

Process of inserting an element in stack is called (a)  

2.

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

3.

Pushing an element into stack already having five elements and stack size of 5, then stack becomes (a)  

4.

Which of the following is true about linked list implementation of stack?

a)

In push operation, if new nodes are inserted at the beginning of linked list, then in pop operation, nodes must be removed from end.

b)

In push operation, if new nodes are inserted at the end, then in pop operation, nodes must be removed from the beginning.

c)

Both of the above

d)

None of the above

5.

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

6.

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)

Overflow occurs

c)

Stack operations are performed smoothly

d)

None of the above

7.

Consider the linked list implementation of a stack. Which of the following node is considered as Top of the stack?

a)

Last node

b)

Any node

c)

First node

d)

Middle node

8.

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

9.

What type of data structure does a Stack is?

a)

Linear

b)

Non -linear

10.

In stacks, the possibility to do insertion and deletion is ____

a)

at one end only

b)

at both ends

11.

From the following which are static and dynamic representations of stacks?

a)

Linked lists – Static, Arrays – Dynamic

b)

Arrays – Static, Linked lists – Dynamic

c)

Queues –Dynamic, Arrays – Static

d)

None of the mentioned

12.

The concept “Pile of Plates” is applicable in which one of the following.

a)

Linked list

b)

Queue

c)

Tree

d)

Stack

13.

When does top value of the stack changes?

a)

Before deletion

b)

After deletion

c)

At the time of deletion

d)

While checking underflow

14.

In the linked list implementation of the stack class, where does the push member function place the new entry on the linked list?

a)

At the head

b)

At the tail

c)

At the middle

d)

None

15.

In linked representation of stack the null pointer of the last node in the list signals __________

a)

Beginning of the stack

b)

Bottom of the stack

c)

Middle of the stack

d)

In between some value

16.

Only top element can be accessed in stack.

a)

True

b)

False

17.

Consider following Scenario -


The five items : P,Q,R,S and T are inserted into stack A one after other starting from T in reverse order.

The stack is popped three times and each element is inserted into another stack B.

Then two elements are deleted from the stack B and pushed back onto the stack A.


What are the topmost elements of stack A and Stack B respectively?

a)

Q P

b)

R P

c)

Q R

d)

R Q

18.

User perform following operations on stack of size 5 then -

push(1);

pop();

push(2);

push(3);

pop();

push(2);

pop();

pop();

push(4);

pop();

pop();

push(5);


Which of the following is correct statement for stack ?

a)

Underflow Occurs

b)

Overflow Occurs

c)

Stack operations will be performed smoothly

19.

What will be the initial value with which top is initialized.

a)

1

b)

0

c)

-1

20.

Choose correct output for the following sequence of operations.

push(5)

push(8)

pop

push(2)

push(5)

pop

pop

pop

push(1)

pop

a)

8 5 2 5 1

b)

8 5 5 2 1

c)

8 2 5 5 1

d)

8 1 2 5 5