πŸ“Š Data Structure (DS)
Q. public int function()
{
if(head == null)
return Integer.MIN_VALUE;
int var;
Node temp = head;
while(temp.getNext() != head)
temp = temp.getNext();
if(temp == head)
{
var = head.getItem();
head = null;
return var;
}
temp.setNext(head.getNext());
var = head.getItem();
head = head.getNext();
return var;
} What is the functionality of the following code? Choose the most appropriate answer.
  • (A) return data from the end of the list
  • (B) returns the data and deletes the node at the end of the list
  • (C) returns the data from the beginning of the list
  • (D) returns the data and deletes the node from the beginning of the list
πŸ’¬ Discuss
βœ… Correct Answer: (D) returns the data and deletes the node from the beginning of the list

You must be Logged in to update hint/solution

πŸ’¬ Discussion

πŸ“Š Question Analytics

πŸ‘οΈ
250
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
80%
Success Rate