
Java Stack Class Quiz

Quiz
•
Computers
•
12th Grade
•
Medium
Jay Ho
Used 2+ times
FREE Resource
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
2
An exception
1
null
Create a free account and access millions of resources
Similar Resources on Wayground
15 questions
Recursion in Java

Quiz
•
11th - 12th Grade
9 questions
Tech Sourcing with Stack Overflow

Quiz
•
12th Grade
10 questions
Berfikir komputasi

Quiz
•
10th - 12th Grade
15 questions
Year 12 Programming

Quiz
•
11th - 12th Grade
15 questions
Internet Structure and Protocol Layering

Quiz
•
12th Grade
10 questions
informatika

Quiz
•
7th Grade - University
15 questions
Data Structures and Algorithms Quiz No.1

Quiz
•
1st Grade - Professio...
10 questions
Programming Basics

Quiz
•
11th - 12th Grade
Popular Resources on Wayground
10 questions
Video Games

Quiz
•
6th - 12th Grade
20 questions
Brand Labels

Quiz
•
5th - 12th Grade
15 questions
Core 4 of Customer Service - Student Edition

Quiz
•
6th - 8th Grade
15 questions
What is Bullying?- Bullying Lesson Series 6-12

Lesson
•
11th Grade
25 questions
Multiplication Facts

Quiz
•
5th Grade
15 questions
Subtracting Integers

Quiz
•
7th Grade
22 questions
Adding Integers

Quiz
•
6th Grade
10 questions
Exploring Digital Citizenship Essentials

Interactive video
•
6th - 10th Grade