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);
}

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

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

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

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

6.

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);
}

7.

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;
}

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

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

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

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

12.

Consider an implementation of unsorted singly linked list. Suppose it has its representation with a head pointer only.
Given the representation, which of the following operation can be implemented in O(1) time?

i) Insertion at the front of the linked list
ii) Insertion at the end of the linked list
iii) Deletion of the front node of the linked list
iv) Deletion of the last node of the linked list

13. In linked list each node contain minimum of two fields. One field is data field to store the data second field is?

14. What would be the asymptotic time complexity to find an element in the linked list?

15. The concatenation of two list can performed in O(1) time. Which of the following variation of linked list can be used?

16.

Consider the following definition in c programming language.Which of the following c code is used to create new node?

struct node
{
int data;
struct node * next;
}
typedef struct node NODE;
NODE *ptr;

17. What kind of linked list is best to answer question like "What is the item at position n"?

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

19. Linked list is considered as an example of ___________ type of memory allocation.

20. In Linked List implementation, a node carries information regarding

21. Linked list data structure offers considerable saving in

22. Which of the following points is/are true about Linked List data structure when it is compared with array

23. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?

24. Given pointer to a node X in a singly linked list. Only one pointer is given, pointer to head node is not given, can we delete the node X from given linked list?

25.

he following C function takes a single-linked list of integers as a parameter and rearranges the elements of the list.
The function is called with the list containing the integers 1, 2, 3, 4, 5, 6, 7 in the given order. What will be the contents of the list after the function completes execution?

struct node
{
int value;
struct node *next;
};
void rearrange(struct node *list)
{
struct node *p, * q;
int temp;
if ((!list) || !list->next)
return;
p = list;
q = list->next;
while(q)
{
temp = p->value;
p->value = q->value;
q->value = temp;
p = q->next;
q = p?p->next:0;
}
}