adplus-dvertising
frame-decoration

Question

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

d.

Return but not delete the first element in the list

Answer: (c).Delete the first element in the list

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the functionality of the following piece of code?