📊 Data Structure (DS)
Q. What is the functionality of the following code? Choose the most appropriate answer. public int function()
{
if(head == null)
return Integer.MIN_VALUE;
int var;
Node temp = head;
Node cur;
while(temp.getNext() != head)
{
cur = temp;
temp = temp.getNext();
}
if(temp == head)
{
var = head.getItem();
head = null;
return var;
}
var = temp.getItem();
cur.setNext(head);
return var;
}
  • (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: (B) returns the data and deletes the node at the end of the list

You must be Logged in to update hint/solution

💬 Discussion

📊 Question Analytics

👁️
685
Total Visits
📽️
3 y ago
Published
🎖️
Mr. Dubey
Publisher
📈
85%
Success Rate