
Java Stack Class Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Jay Ho
Used 2+ times
FREE Resource
Enhance your content in a minute
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
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
10 questions
EMPTECH L4 Q3
Quiz
•
12th Grade
10 questions
JSPS Competition Hackathon - Scratch Language - Grade 1
Quiz
•
2nd Grade - University
10 questions
cybercrime
Quiz
•
12th Grade - University
10 questions
Microcontroller
Quiz
•
11th Grade - University
14 questions
Input, output and storage de
Quiz
•
8th Grade - Professio...
10 questions
ZOOM QUIZ
Quiz
•
1st - 12th Grade
15 questions
Visual C# Quiz - Chapter 5: Loops, Files, and Random Numbers
Quiz
•
12th Grade
10 questions
Anime
Quiz
•
KG - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
