Java Stack Class Quiz

Java Stack Class Quiz

12th Grade

14 Qs

quiz-placeholder

Similar activities

U26 Q7 - CIDR

U26 Q7 - CIDR

KG - University

12 Qs

Chapter 2: Input Device

Chapter 2: Input Device

12th Grade - University

12 Qs

User Interface Design - Topic 1

User Interface Design - Topic 1

12th Grade

15 Qs

3rd week g9 summative

3rd week g9 summative

7th - 12th Grade

15 Qs

Treasure Hunt

Treasure Hunt

12th Grade

10 Qs

Penilaian Harian-1, Pemrograman Berorientasi Objek (PBO)

Penilaian Harian-1, Pemrograman Berorientasi Objek (PBO)

12th Grade

10 Qs

Recap

Recap

12th Grade

10 Qs

Computer Basics 2 - CESA

Computer Basics 2 - CESA

7th Grade - University

10 Qs

Java Stack Class Quiz

Java Stack Class Quiz

Assessment

Quiz

Computers

12th Grade

Practice Problem

Medium

Created by

Jay Ho

Used 2+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

14 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary principle on which the Stack class in Java is based?

First-in-first-out (FIFO)

Last-in-first-out (LIFO)

First-in-last-out (FILO)

Last-in-last-out (LILO)

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to add an element to the top of the stack?

add()

insert()

push()

append()

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to remove the top element from the stack?

discard()

pop()

delete()

remove()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the peek() method do in a Stack?

Returns the top element without removing it

Adds an element to the top

Checks if the stack is empty

Removes the top element

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which interface does the Stack class implement?

Queue

List

Set

Map

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What will the search() method return if the element is not found in the stack?

null

0

-1

An exception

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the output of the following code snippet? Stack stack = new Stack<>(); stack.push(1); stack.push(2); System.out.println(stack.pop());

2

An exception

1

null

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?