Search Header Logo

Stack Operations Quiz 1

Authored by HASAN YIGIT

Computers

University

Used 1+ times

Stack Operations Quiz 1
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the peek() operation do in a stack?

Returns the top element without removing it.

Removes the top element.

Adds an element to the stack.

Clears the stack.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Given the stack operations: Push(3), Push(5), Pop(), Push(7), Push(9), what is the stack content (top to bottom)?

7, 9

9, 7, 3

3, 9, 7

None of the above

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which data structure can evaluate postfix expressions?

Queue

Stack

Binary Tree

Linked List

4.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

What does the following code accomplish? if (stack->top capacity / 4) { resizeStack(stack, stack->capacity / 2); }

Increases the stack size.

Decreases the stack size.

Checks if the stack is empty.

Duplicates the stack.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following sequence? push(5); push(10); pop(); push(20); pop(); peek();

5

10

20

None of the above

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the condition to increase the stack size dynamically in an array implementation?

top == capacity - 1

top == 0

capacity > top

stack isEmpty()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the order of operations in infix notation?

Operators are between operands

Operators come before operands

Operators come after operands

None of the above

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?