The following C function takes a singly-linked list as input argument. It modifies the list by moving the last element to the front of the list and returns the modified list. Some part of the code is left blank. Choose the correct alternative to replace the blank line.
typedef struct node
{
int value;
struct node *next;
}Node;
Node *move_to_front(Node *head)
{
Node *p, *q;
if ((head == NULL: || (head🡪next == NULL))
return head;
q = NULL; p = head;
while (p-> next !=NULL)
{
q = p;
p = p->next;
}
_______________________________
return head;
}
2010 || MCQ || 2-mark
q = NULL; p→next = head; head = p;
q→next = NULL; head = p; p→next = head;
head = p; p→next = q; q→next = NULL;
q→next = NULL; p→next = head; head = p;
This question is part of this quiz :
GATE|| C Programming & Data Structure || Pyqs (2010 to 2025 ),GATE || Arrays | Stacks | Queue | Linked list || PYQS (2010 to 2025)