Examveda

What is the functionality of the following piece of code?
public int function()
{
	Node temp = tail.getPrev();
	tail.setPrev(temp.getPrev());
	temp.getPrev().setNext(tail);
	size--;
	return temp.getItem();
}

A. Return the element at the tail of the list but do not remove it

B. Return the element at the tail of the list and remove it from the list

C. Return the last but one element from the list but do not remove it

D. Return the last but one element at the tail of the list and remove it from the list

Answer: Option D


This Question Belongs to Data Structure >> Introduction To Data Structures

Join The Discussion

Related Questions on Introduction to Data Structures