# Data Structure Questions and Answers-Doubly Linked List

BUY PDF <<CLICK HERE>>

## Data Structure Questions and Answers-Doubly Linked List

Congratulations - you have completed Data Structure Questions and Answers-Doubly Linked List.

You scored %%SCORE%% out of %%TOTAL%%.

Your performance has been rated as %%RATING%%

Your answers are highlighted below.
 Question 1 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Which of the following is false about a doubly linked list?
 A We can navigate in both the directions B It requires more space than a singly linked list C The insertion and deletion of a node take a bit longer D None of the mentioned
KBC Questions answers
Question 1 Explanation:
A doubly linked list has two pointers 'left' and 'right' which enable it to traverse in either direction. Compared to singly liked list which has only a 'next' pointer, doubly linked list requires extra space to store this extra pointer. Every insertion and deletion requires manipulation of two pointers, hence it takes a bit longer time.

 Question 2 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Given the Node class implementation, select one of the following that correctly inserts a node at the tail of the list.

public class Node { 	protected int data; 	protected Node prev; 	protected Node next; 	public Node(int data) 	{ 		this.data = data; 		prev = null; 		next = null; 	} 	public Node(int data, Node prev, Node next) 	{ 		this.data = data; 		this.prev = prev; 		this.next = next; 	} 	public int getData() 	{ 		return data; 	} 	public void setData(int data) 	{ 		this.data = data; 	} 	public Node getPrev() 	{ 		return prev; 	} 	public void setPrev(Node prev) 	{ 		this.prev = prev; 	} 	public Node getNext 	{ 		return next; 	} 	public void setNext(Node next) 	{ 		this.next = next; 	} } public class DLL { 	protected Node head; 	protected Node tail; 	int length; 	public DLL() 	{ 		head = new Node(Integer.MIN....VALUE, null, null); 		tail = new Node(Integer.MIN....VALUE, null, null); 		head.setNext(tail); 		length = 0; 	} }
 A public void insertRear(int data) { Node node = new Node(data, tail.getPrev(), tail); node.getPrev().setNext(node); tail.setPrev(node) B public void insertRear(int data) { Node node = new Node(data, tail.getPrev(), tail); node.getPrev().getPrev().setNext(node); tail C public void insertRear(int data) { Node node = new Node(data, tail.getPrev(), tail); node.getPrev().setNext(tail); tail.setPrev(node) D public void insertRear(int data) { Node node = new Node(data, head, tail); node.getPrev().setNext(node); tail.setPrev(node); length++;
Civics Test Questions answers
Question 2 Explanation:
First create a new node whose 'prev' points to the node pointed to by the 'prev' of tail. The 'next' of the new node should point to tail. Set the 'prev' of tail to point to new node and the 'prev' of new node to point to the new node.

 Question 3 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
What is a memory efficient double linked list?
 A Each node has only one pointer to traverse the list back and forth B The list has breakpoints for faster traversal C An auxiliary singly linked list acts as a helper list to traverse through the doubly linked list D None of the mentioned
Aptitude test Questions answers
Question 3 Explanation:
Memory efficient doubly linked list has been proposed recently which has only one pointer to traverse the list back and forth. The implementation is based on pointer difference.

 Question 4 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
Which of the following piece of code removes the node from a given position?
 A public void remove(int pos) { if(pos<0 || pos>=size) { System.out.println("Invalid position"); return; }  B public void remove(int pos) { if(pos<0 || pos>=size) { System.out.println("Invalid position"); return; }  C public void remove(int pos) { if(pos<0 || pos>=size) { System.out.println("Invalid position"); return D None of the mentioned
Computer science (GATE/NET) Questions answers
Question 4 Explanation:
If the position to be deleted is not the head, advance to the given position and manipulate the previous and next pointers of next and previous nodes respectively.

 Question 5 [CLICK ON ANY CHOICE TO KNOW MCQ multiple objective type questions RIGHT ANSWER]
How do you calculate the pointer difference in a memory efficient double linked list?
 A head xor tail B pointer to previous node xor pointer to next node C pointer to previous node - pointer to next node D pointer to next node - pointer to previous node
Bank exam Questions answers
Question 5 Explanation:
The pointer difference is calculated using option b.

Once you are finished, click the button below. Any items you have not completed will be marked incorrect.
There are 5 questions to complete.

BUY PDF <<CLICK HERE>>