Multiple Choice
Insert the missing code in the following code fragment. This fragment is intended to remove a node from the head of a linked list: public class LinkedList
{
) . .
Public Object removeFirst()
{
If (first == null) { ________________ }
Object element = first.data;
First = first.next; 1
Return element;
}
) . .
}
A) throw new NoSuchElementException() ;
B) throw new IllegalStateException() ;
C) throw new NullPointerException() ;
D) throw new IllegalArgumentException() ;
Correct Answer:

Verified
Correct Answer:
Verified
Q19: Why is it not typical to use
Q68: Which statement about handling collisions in a
Q69: Suppose we maintain a linked list of
Q71: Adding or removing an element at an
Q73: Given the partial LinkedList class declaration below,
Q74: You have implemented a queue as a
Q75: Given the partial ArrayList class declaration below,
Q76: Which of the following statements about hash
Q77: On average, how many elements of an
Q86: What feature of the ArrayList class makes