Stack Queue

Stack Queue

Professional Development

5 Qs

quiz-placeholder

Similar activities

SAA-C03 - Módulo 12

SAA-C03 - Módulo 12

Professional Development

10 Qs

AWS SQS and SNS Quiz

AWS SQS and SNS Quiz

Professional Development

10 Qs

Zoom CC Quiz Session 2

Zoom CC Quiz Session 2

Professional Development

10 Qs

Vectores I

Vectores I

6th Grade - Professional Development

5 Qs

Manage communication in Microsoft Teams

Manage communication in Microsoft Teams

Professional Development

7 Qs

Vectores II

Vectores II

6th Grade - Professional Development

5 Qs

git basics

git basics

Professional Development

10 Qs

PreTrainingCollectionsArrays

PreTrainingCollectionsArrays

Professional Development

9 Qs

Stack Queue

Stack Queue

Assessment

Quiz

Computers

Professional Development

Medium

Created by

Gulzina Nagibova

Used 2+ times

FREE Resource

5 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

pop, push 59, pop, push 91, pop, peek, pop, push 1

push 1, pop, push 59, pop, push 91, pop, peek, pop, push 17

peek, push 59, pop, push 91, pop, pop, push 1

peek, pop, pop, pop, push 1, push 59, pop, push 19, peek

2.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

The following statements, in structured English, form the algorithm for the pop operation on a stack. Find the correct order.

  1. 1. If stack is empty, dispaly error and return/halt

  2. 2. Check if the stack is empty

  3. 3. Decrement stack_pointer by one

  4. 4. Else return the data item indexed by stack_pointer

1,2,3,4

2,1,4,3

3,2,1,4

3,1,4,2

3.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

The following diagram is an abstraction of a stack. The stack currently contains three items (names). The pointer to the top of the stack is shown in pink.

The following operations are carried out in the order given:

  • push Harry

  • pop

  • push Luna

  • peek

  • pop

  • pop

To which position will the top pointer point after all the operations have been carried out?

0

2

1

3

4.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Media Image

The following diagram is an abstraction of a queue. The queue will be implemented using a static array and circular queue methods are used to make efficient use of space.
The front pointer (black) points to the start of the queue. The rear pointer (pink) points to the end of the queue.

Dan is at the front of the queue in position 0. A series of operations occur as follows:

  • enqueue Nigel,

  • enqueue Anil,

  • enqueue Sasham,

  • dequeue,

  • enqueue Jordan,

  • dequeue,

  • enqueue Aayna,

  • enqueue Germaine,

  • dequeue,

  • dequeue,

  • enqueue Tom,

  • enqueue Ben,

  • dequeue,

  • enqueue Amar


To which position will front point after all the operations have been carried out?

4

6

5

0

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Sam wants to make sure that everyone gets a piece of the festive cake before they go for seconds. The cake has 15 pieces and his friends are Brandon, Millie, Dorris, Adele, Robin, and Joe.

He uses a linear queue to manage cake requests. When a person is given a piece of cake they are enqueued. When a person has eaten their piece of cake and are ready for another one, they are dequeued.

The following diagram is an abstraction of a linear queue that is used to represent the slices of cake. At the moment, the queue is empty. The front pointer (the black knife) points to the start of the queue. The rear pointer (the orange fork) points to the end of the queue. Each piece of cake is in a specific position in the queue and the first piece is in position 0.

To which position will front point after Brandon and Millie have finished their first piece of cake and are having seconds, but all of the other people are still eating their first piece?

2

4

6

8