/* */ Click to Join Live Class with Shankar sir Call 9798158723

Data Structure MCQ - Linked List


Q1.Which of the following information is stored in a doubly-linked list’s nodes?
  1. Value of node
  2. Address of next node
  3. Address of the previous node
  4. All of the above

Answer:- (D).
Explanations : Explanation: A doubly linked list stores information about the value, and addresses of previous and next nodes.
Q2. A linear collection of data elements where the linear node is given by means of pointer is called?
  1. Node list
  2. Linked list
  3. Primitive list
  4. Unordered list

Answer:- (B).
Explanations :In Linked list each node has its own data and the address of next node. These nodes are linked by using pointers. Node list is an object that consists of a list of all nodes in a document with in a particular selected set of nodes.
Q3.In linked list each node contains a minimum of two fields. One field is data field to store the data second field is?
  1. Pointer to character
  2. Pointer to integer
  3. Node
  4. Pointer to node

Answer:- (D).
Explanations :Each node in a linked list contains data and a pointer (reference) to the next node. Second field contains pointer to node.
Q4.What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list?
  1. O(1)
  2. O(n)
  3. θ(1)
  4. θ(n)

Answer:- (D).
Explanations :In case of a linked list having n elements, we need to travel through every node of the list to add the element at the end of the list. Thus asymptotic time complexity is θ(n).
Q5.The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used?
  1. Singly linked list
  2. Circular doubly linked list
  3. Doubly linked list
  4. Array implementation of list

Answer:- (B).
Explanations :We can easily concatenate two lists in O (1) time using singly or doubly linked list, provided that we have a pointer to the last node at least one of the lists. But in case of circular doubly linked lists, we will break the link in both the lists and hook them together. Thus circular doubly linked list concatenates two lists in O (1) time.
Q6.Linked lists are not suitable for the implementation of ___________
  1. Binary search
  2. Insertion sort
  3. Radix sort
  4. Polynomial manipulation

Answer:- (A).
Explanations :It cannot be implemented using linked lists.
Q7. Linked list data structure offers considerable saving in _____________
  1. Space Utilization and Computational Time
  2. Computational Time
  3. Space Utilization
  4. Speed Utilization

Answer:- (A).
Explanations :Linked lists saves both space and time.
Q8.Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
  1. Insertion Sort
  2. Quick Sort
  3. Merge Sort
  4. Heap Sort

Answer:- (C).
Explanations :Both Merge sort and Insertion sort can be used for linked lists. The slow random-access performance of a linked list makes other algorithms (such as quicksort) perform poorly, and others (such as heapsort) completely impossible. Since worst case time complexity of Merge Sort is O(nLogn) and Insertion sort is O(n2), merge sort is preferred.
Q9.What is the output of following function for start pointing to first node of following linked list?
1->2->3->4->5->6
void fun(struct node* start)
{
    if(start == NULL)
    return;
    printf("%d  ", start->data); 
    if(start->next != NULL )
    fun(start->next->next);
    printf("%d  ", start->data);
}
  1. 1 4 6 6 4 1
  2. 1 3 5 1 3 5
  3. 1 3 5 5 3 1
  4. 1 2 3 5

Answer:- (C).
Explanations :fun() prints alternate nodes of the given Linked List, first from head to end, and then from end to head. If Linked List has even number of nodes, then skips the last node
Q10.You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list?
  1. Delete the first element
  2. Delete the last element of the list
  3. Insert a new element as a first element
  4. Add a new element at the end of the list

Answer:- (B).
Explanations :Deletion of the first element of the list is done in O (1) time by deleting memory and changing the first pointer. Insertion of an element as a first element can be done in O (1) time. We will create a node that holds data and points to the head of the given linked list. The head pointer was changed to a newly created node. Deletion of the last element requires a pointer to the previous node of last, which can only be obtained by traversing the list. This requires the length of the linked list. Adding a new element at the end of the list can be done in O (1) by changing the pointer of the last node to the newly created node and last is changed to a newly created node.