In a doubly circular linked list MCQ

Post navigation
Data Structure Questions and Answers-Doubly Linked List Data Structure Questions and Answers-Stack using Array

DOWNLOAD ALL SUBJECTS PDF <>

Page 1 of 212Next»

Data Structure Questions and Answers-Circular Linked List

Please wait while the activity loads.
If this activity does not load, try refreshing your browser. Also, this page requires javascript. Please visit using a browser with javascript enabled.
If loading fails, click here to try again
Question 1 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What differentiates a circular linked list from a normal linked list?
A
You cannot have the 'next' pointer point to null in a circular linked list
B
It is faster to traverse the circular linked list
C
You may or may not have the 'next' pointer point to null in a circular linked list
D
All of the mentioned
Question 1 Explanation:
The 'next' pointer points to null only when the list is empty, otherwise it points to the head of the list.
Question 2 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
How do you count the number of elements in the circular linked list?
A
public int length(Node head) { int length = 0; if( head == null) return 0; Node temp = head.getNext(); while(temp
B
public int length(Node head) { int length = 0; if( head == null) return 0; Node temp = head.getNext(); while(temp
C
public int length(Node head) { int length = 0; if( head == null) return 0; Node temp = head.getNext(); while(temp
D
None of the mentioned
Question 2 Explanation:
If the head is null, it means that the list is empty. Otherwise, traverse the list until the head of the list is reached.
Question 3 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the functionality of the following piece of code? Select the most appropriate
public void function(int data) { int flag = 0; if( head != null) { Node temp = head.getNext(); while((temp != head) && (!(temp.getItem() == data))) { temp = temp.getNext(); flag = 1; break; } } if(flag) System.out.println("success"); else System.out.println("fail"); }
A
Print success if a particular element is not found
B
Print fail if a particular element is not found
C
Print success if a particular element is equal to 1
D
Print fail if the list is empty
Question 3 Explanation:
The function prints fail if the given element is not found. Note that this option is inclusive of option d, the list being empty is one of the cases covered.
Question 4 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
What is the time complexity of searching for an element in a circular linked list?
A
O(n)
B
O(nlogn)
C
O(1)
D
None of the mentioned
Question 4 Explanation:
In the worst case, you have to traverse through the entire list of n elements.
Question 5 [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which of the following application makes use of a circular linked list?
A
Undo operation in a text editor
B
Recursive function calls
C
Allocating CPU to resources
D
All of the mentioned
Question 5 Explanation:
Generally, round robin fashion is employed to allocate CPU time to resources which makes use of the circular linked list data structure.
There are 5 questions to complete.