A

Admin • 828.43K Points
Coach

Q. What does `peek()` do in a Deque context?

  • (A) Removes the head element
  • (B) Returns head element without removing it
  • (C) Throws exception if deque is empty
  • (D) Returns the last element
  • Correct Answer - Option(B)
  • Views: 10
  • Filed under category Java
  • Hashtags: Java Deque

Explanation by: Admin
`peek()` retrieves but does not remove the head of the deque.

You must be Logged in to update hint/solution

Discusssion

Login to discuss.

Be the first to start discuss.