Search Header Logo

Understanding Stacks and Queues

Authored by Matthew Wemyss

Computers

11th Grade

Used 1+ times

Understanding Stacks and Queues
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the initial value of `toppointer` in the stack implementation?

0

-1

1

10

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when you try to push an item onto a full stack?

The item is added to the stack

The stack is cleared

A message "Stack is full, cannot push" is printed

The stack size is increased

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

After executing the sequence of operations `push(10)`, `push(20)`, `push(30)`, `pop()`, `push(40)`, what is the value at `stack[2]`?

10

20

30

40

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the initial value of `rearPointer` in the queue implementation?

0

-1

1

10

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the purpose of the `pop()` function in the stack implementation?

To add an item to the stack

To remove the top item from the stack

To check if the stack is full

To clear the stack

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the condition to check if the stack is empty in the `pop()` function?

`toppointer == 0`

`toppointer == -1`

`toppointer == len(stack)`

`toppointer == 10`

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the initial value of `frontPointer` in the queue implementation?

0

-1

1

10

Access all questions and much more by creating a free account

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?

Discover more resources for Computers