JavaScript isn't enabled in your browser, so this file can't be opened. Enable and reload.
Java Ch. 17 Quiz
Stacks and Queues
Sign in to Google
to save your progress.
Learn more
* Indicates required question
In a queue, which element in the list would be popped?
*
The last one that was put in.
The first one that was put in.
The element that comes first lexicographically
None of the above
What is E in Java?
*
A type of queue
A Java Generic that can stand in for a specific type
An easy way to catch exceptions in Queues and Stacks
An interface which is implemented by Queues and Stacks
Which Queue or Stack method does NOT use zero-indexing?
*
add(E e)
offer(E e)
search(Object)
pop()
If I fill a queue and a stack with the numbers 4, 59, 125(in that order), which number would be returned if I run peek()?
*
Queue: 4; Stack: 125;
Stack: 125; Queue: 4;
Stack: 125; Queue: 125;
Stack: 4; Queue 4;
Code for question below
Stack<Integer> example = new Stack<Integer>();
System.out.print(example.empty() + “ “);
example.push(1);
System.out.print(example.pop() + “ “ + example.empty());
What does the code above output?
*
false 1 true
true false
true 1 true
false true
What would be the best use of a Queue?
*
Storing a list of random numbers
Storing the survey results of a random sample
Storing the participants in a quiz game in order of how fast they answered
Submit
Clear form
Forms
This form was created inside of Irvine LIGHTS.
Report Abuse
Terms of Service
Privacy Policy
Help and feedback
Help Forms improve
Report