exam questions

Exam 1z0-804 All Questions

View all questions & answers for the 1z0-804 exam

Exam 1z0-804 topic 1 question 32 discussion

Actual exam question from Oracle's 1z0-804
Question #: 32
Topic #: 1
[All 1z0-804 Questions]

Given the following code fragment:

What is the result?

  • A. Three
  • B. One
  • C. Compilation fails
  • D. The program runs, but prints no outout
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️
add
boolean add(E e)
Inserts the specified element into the queue represented by this deque (in other words, at the tail of this deque) if it is possible to do so immediately without violating capacity restrictions, returning true upon success and throwing an IllegalStateException if no space is currently available. When using a capacity- restricted deque, it is generally preferable to use offer.
This method is equivalent to addLast(E).
remove
E remove()
Retrieves and removes the head of the queue represented by this deque (in other words, the first element of This deque). This method differs from poll only in that it throws an exception if this deque is empty.
This method is equivalent to removeFirst().
Returns:
The head of the queue represented by this deque
Class ArrayDeque

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
Currently there are no comments in this discussion, be the first to comment!
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...