51.
The following C function takes a simply-linked list as an 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;
}

53.
Elements in an array are accessed . . . . . . . .

54.
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

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

Read More Section(Introduction to Data Structures)

Each Section contains maximum 100 MCQs question on Introduction to Data Structures. To get more questions visit other sections.