(Choose 1 answer)
Select the most correct java code snippet that deletes the last node.
Suppose we are considering a singly linked list which has at least 2 nodes.
A. Node f = head;
while(f.next != tail) f = f.next;f.next = null;
B. Node f = head;while(f.next != tail) f = f.next;f.next = null;
tail = f;
C. Node f = head;while(f != tail) f = f.next;f.next = null;tail = f;
D. Node f = head;while(f.next != tail) f = f.next;tail = f;
37/50-CAP
Q: 39