Multiple choice

Which of the following statements is correct for methods in the queue?

  1. Peek() method retrieves and removes the head of the queue and returns Null if the queue is empty.

  2. Peek() method retrieves and removes the head of the queue and returns nothing if the queue is empty.

  3. Peek() method retrieves, but doesn’t remove the head of the queue and returns Null if the queue is empty.

  4. Peek() method retrieves and removes the head of the queue and throws an exception if the queue is empty.

  5. Peek() method retrieves, but doesn’t remove the head of the queue and throws an exception if the queue is empty.

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

This is the correct answer.