Vidyalelo
Data Structure · Q55

Introduction to Data Structures

Programming · Data Structure · question 55

Q55

What is the functionality of the following piece of code? public Object delete_key() if(count == 0) System.out.println("Q is empty"); System.exit(0); else Node cur = head.getNext(); Node dup = cur.getNext(); Object e = cur.getEle(); head.setNext(dup); count--; return e;

A.
Delete the second element in the list
B.
Return but not delete the second element in the list
C.
Delete the first element in the list
Answer
D.
Return but not delete the first element in the list

Answer: Option C

Solution

Answer: Option C
No explanation is given for this question Let's Discuss on Board