wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

QUIZ-STACK_QUEUE_Jan'24

Total questions: 25

Worksheet time: 22mins

Name
Class
Date
1.

In which algorithm takes less time or space is called

a)

Best case

b)

Worst case

c)

Average case

d)

None of the above

2.

A FIFO structure implemented as a ring where the front and rear pointers can wrap around the end of the start of the array.

a)

Linear Queue

b)

Circular Queue

c)

Priority Queue

3.

What is the disadvantage of array data structure?

a)

Elements of an array can be accessed in constant time

b)

Elements are stored in contiguous memory location

c)

The amount of memory to be allocated should be known beforehand

d)

Multiple other data structures can be implemented using Array

4.

How can we describe an array in the best possible way?

a)

The Array shows a hierarchical structure.

b)

Arrays are immutable (Not Modifiable)

c)

Container that stores the elements of similar types

d)

The Array is not a data structure

5.

____________data structures are those whose sizes and structures associated memory locations are fixed at compile time.

a)

linear

b)

homogeneous

c)

static

d)

dynamic

6.

People have used the word ________ to mean computer information that is transmitted or stored.

a)

Beta

b)

Data

c)

Database

d)

None of above

7.

Consider the usual algorithm for determining whether a sequence of parentheses is balanced.

Suppose that you run the algorithm on a sequence that contains 2 left parentheses and 3 right parentheses (in some order).

The maximum number of parentheses that appear on the stack AT ANY ONE TIME during the computation?

a)

1

b)

2

c)

3

d)

4 or more

8.

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

a)

Overflow Occurs

b)

Stack Operations will be performed Smoothly

c)

Underflow Occurs

d)

None of these

9.

To evaluate an expression without any embedded function calls:

a)

One stack is enough

b)

Two stacks are needed

c)

As many stacks as the height of the expression tree are needed

d)

A Turing machine is needed in the general case

10.

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 / ∗ ∗

11.

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

12.

The five items: A, B, C, D, and E are pushed in a stack, one after other starting from A. The stack is popped four items and each element is inserted in a queue. The two elements are deleted from the queue and pushed back on the stack. Now one item is popped from the stack. The popped item is

a)

A

b)

B

c)

C

d)

D

e)

E

13.

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 the above

14.

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

15.

In linked list implementation of a queue, the important condition for a queue to be empty is?

a)

FRONT is null

b)

REAR is null

c)

LINK is empty

d)

None of the mentioned

16.

Let the following circular queue can accommodate maximum six elements with the following data


front = 2 rear = 4

queue = _______; L, M, N, ___, ___


What will happen after ADD O operation takes place?

a)

front = 2 rear = 5

queue = ______; L, M, N, O, ___

b)

front = 3 rear = 5

queue = L, M, N, O, ___

c)

front = 3 rear = 4

queue = ______; L, M, N, O, ___

d)

front = 2 rear = 4

queue = L, M, N, O, ___

17.

A circular queue is implemented using an array of size 10. The array index starts with 0, front is 6, and rear is 9. The insertion of next element takes place at the array index.

a)

0

b)

7

c)

9

d)

10

18.

What is the reason for using a "circular queue" instead of a regular one?

a)

running time of enqueue() is improved

b)

reuse empty spaces

c)

you can traverse all the elements more efficiently

d)

none of the above

19.

One difference between a queue and a stack is:

a)

Queues require dynamic memory, but stacks do not

b)

Stacks require dynamic memory, but queues do not.

c)

Queues use two ends of the structure; stacks use only one.

d)

Stacks use two ends of the structure, queues use only one.

20.

The essential condition which is checked before insertion in a linked queue is?

a)

Underflow

b)

Overflow

c)

Front value

d)

Rear value

21.

A queue of characters currently contained a,b,c,d. What would be the contents of queue after the following operationDELETE, ADD W, ADD X, DELETE, ADD Y.

a)

A,B,C,W,Y

b)

A,B,C,D,W

c)

C,D,W,X,Y

d)

W,Y,X,C,D

22.

Where would pointers be pointing if...

  1. Eli leaves the Queue.
  2. Hanna joins the Queue.
  3. Adam joins the Queue.
  4. Jason leaves the Queue.
a)

front = 0 rear = 5

b)

front = 1 rear = 4

c)

front = 2 rear = 4

d)

front = 0 rear = 4

e)

front = 2 rear = 5

23.

What would happen if...

deQueue()

enQueue(Hanna)

enQueue(Steve)

enQueue(Jack)

a)

front = 1 rear = 0

*and Steve would be unable to be added to position 0.

b)

front = 1 rear = 5

*and Jack would be unable to be added to position 0

c)

front = 0 rear = 5

d)

front = 0 rear = 4

e)

front = 1 rear = 4

24.

If REAR, FRONT are the queue variables, then identify correct statement while inserting a value

a)

FRONT=1

b)

REAR=REAR+1

c)

REAR=REAR-1

d)

FRONT=FRONT-1

25.

Which is the application of a queue?

a)

CPU allocation

b)

Sharing printer

c)

Graph traversal

d)

All