## Data Structure MCQ - Linked List

This section focuses on the "Linked List" of the Data Structure. These Multiple Choice Questions (mcq) should be practiced to improve the Data Structure skills required for various interviews (campus interview, walk-in interview, company interview), placement, entrance exam and other competitive examinations.

1. What does the following function do for a given Linked List with first node as head?

void fun1(struct node* head)

{

if(head == NULL)

return;

fun1(head->next);

printf("%d ", head->data);

}

View Answer

2. A linear collection of data elements where the linear node is given by means of pointer is called?

View Answer

3. What is the time complexity to count the number of elements in the linked list?

View Answer

4. 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?

View Answer

5. 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);

}

View Answer

6. What is the functionality of the following piece of code?

public int function(int data)

{

Node temp = head;

int var = 0;

while(temp != null)

{

if(temp.getData() == data)

{

return var;

}

var = var+1;

temp = temp.getNext();

}

return Integer.MIN_VALUE;

}

View Answer

7. Linked lists are not suitable to for the implementation of?

View Answer

8. In the worst case, the number of comparisons needed to search a singly linked list of length n for a given element is

View Answer

9. Which of these is an application of linked lists?

View Answer

10. In circular linked list, insertion of node requires modification of?

View Answer

**Also Check : **