Singly Linked List MCQs: 12 Solved Questions on Basics and Operations

Solve 12 singly linked list questions step by step, then use the trap list and complexity table to revise the operations that cause the most mistakes.

KnowledgeGate Team

Exam prep & CS education

Updated 17 Sep 20268 min read

Each SLL node stores data and one next link to its successor. Start at head and follow next until NULL; no node can move backwards or jump by index. That access model makes head insertion constant-time, but finding the nth node, a predecessor, or the tail without a stored tail pointer requires a forward walk. Use these invariants to attempt all 12 before checking the answers.

Fix the SLL mental model before solving

In head -> 10 -> 20 -> 30 -> 40 -> NULL, each node holds data and next. A stored tail identifies 40, not 30. There are no backward links or indexes. Known-pointer work is O(1); finding a predecessor or nth node is O(n). Scattered nodes still form a linear list.

Singly linked list of nodes 10, 20, 30, 40 in scattered memory, with the head pointer and forward next arrows reaching node 30 in two hops.

Questions 1-3: structure, node fields and traversal

Question 1. Classify the structure

Asked in: DSSSB 2018

Linked List is a _____ data structure.

  • (a) Linear

  • (b) Non-linear

  • (c) Virtual

  • (d) Imaginary

Answer: (a) Linear. Scattered addresses still form one logical chain; physical layout does not change its shape.

Question 2. What the pointer field stores

Asked in: Beltron Programmer 2025

What does the pointer in each node of a singly linked list typically store?

  • (a) The number of remaining nodes in the list

  • (b) A reference to the next node in the sequence

  • (c) A reference to the previous node

  • (d) The index position of the node

Answer: (b) The next-node reference. Node 20 has data 20 and next = 0xC0, node 30's address; prev belongs to a DLL.

Question 3. The only valid traversal direction

Asked in: Beltron Programmer 2025

Which statement accurately describes how to traverse a singly linked list?

  • (a) Begin from the tail node and move backward toward the head node

  • (b) Start from the head node and visit each subsequent node by following the next pointer until reaching a null reference

  • (c) Start at any node and move through nodes using the previous pointers

  • (d) Access nodes randomly by their index similar to arrays

Answer: (b). Follow next from 10 through 40 and stop at current == NULL. There is no backward or indexed access.

Questions 4-6: which operations are O(1)

Question 4. Head-only representation

Asked in: eLitmus 2023

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

  • (a) I and II

  • (b) I and III

  • (c) I, II and III

  • (d) I, II and IV

Answer: (b) I and III. Use 5.next = 10; head = 5 or head = 20. End operations need traversal because no tail is stored.

Question 5. Head and tail are both known

Asked in: Indian Space Research Organization 2018

Consider a singly linked list of the form where F is a pointer to the first element in the linked list and L is the pointer to the last element in the list. The time of which of the following operations depends on the length of the list?

  • (a) Delete the last element of the list

  • (b) Delete the first element of the list

  • (c) Add an element after the last element of the list

  • (d) Interchange the first two elements of the list

Answer: (a) Delete the last element. Find 30, then set 30.next = NULL; L = 30; tail does not reveal its predecessor.

Question 6. Worst-case search comparisons

Asked in: GATE 2002

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

  • (a) log₂ n

  • (b) n/2

  • (c) log₂ n - 1

  • (d) n

Answer: (d) n. Searching for 99 compares 10, 20, 30, 40: four nodes, four comparisons. Thus n nodes need n, not n/2.

Questions 7-9: cumulative cost and deletion traps

Question 7. Repeated sorted insertion

Asked in: GATE 2020

What is the worst case time complexity of inserting \(n\) elements into an empty linked list, if the linked list needs to be maintained in sorted order ?

  • (a) \(\theta (n)\)

  • (b) \(\theta (n \ log \ n)\)

  • (c) \(\theta (n^2)\)

  • (d) \(\theta (1)\)

Answer: (c) θ(n2)\theta(n^2). New maxima 10, 20, 30, 40, 50 cost 0 + 1 + 2 + 3 + 4 = 10 visits. Generally, 0 + ... + (n - 1) = n(n - 1)/2; finding positions costs time.

Question 8. SLL deletion versus DLL deletion

Asked in: GATE 2023

Let SLLdel be a function that deletes a node in a singly-linked list given a pointer to the node and a pointer to the head of the list. Similarly, let DLLdel be another function that deletes a node in a doubly-linked list given a pointer to the node and a pointer to the head of the list. Let n denote the number of nodes in each of the linked lists. Which one of the following choices is TRUE about the worst-case time complexity of SLLdel and DLLdel?

  • (a) SLLdel is O(1) and DLLdel is O(n)

  • (b) Both SLLdel and DLLdel are O(log(n))

  • (c) Both SLLdel and DLLdel are O(1)

  • (d) SLLdel is O(n) and DLLdel is O(1)

Answer: (d). An SLL finds 40's predecessor from head; a DLL uses 40.prev. Copy-next fails for the tail.

Question 9. Queue operations in the costly direction

Asked in: GATE 2018

A queue is implemented using a non-circular singly linked list. The queue has a head pointer and a tail pointer, as shown in the figure. Let \(n\) denote the number of nodes in the queue. Let \(enqueue \) be implemented by inserting a new node at the head, and \(dequeue \) be implemented by deletion of a node from the tail. Which one of the following is the time complexity of the most time-efficient implementation of \(enqueue \) and \(dequeue \), respectively, for this data structure?

  • (a) \(θ(1), θ(1)\)

  • (b) \(θ(1), θ(n)\)

  • (c) \( θ(n), θ(1) \)

  • (d) \(θ(n), θ(n)\)

Answer: (b) θ(1),θ(n)θ(1), θ(n). Enqueue via 5.next = 10; head = 5. Dequeue 40 after walking through 5, 10, 20, 30.

Questions 10-12: pointer rewiring and recursive code

Question 10. Move the last node to the front

Asked in: GATE 2010

The following C function takes a simply-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.

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

Choose the correct alternative to replace the blank line.

  • (a) q = NULL; p->next = head; head = p;

  • (b) q->next = NULL; head = p; p->next = head;

  • (c) head = p; p->next = q; q->next = NULL;

  • (d) q->next = NULL; p->next = head; head = p;

Answer: (d). With q = 30, p = 40, apply q->next = NULL, p->next = head, head = p. Result: 40 -> 10 -> 20 -> 30 -> NULL. Option (b) self-links p.

Before and after diagram for Question 10: the last node 40 moves to the front, changing 10, 20, 30, 40 into 40, 10, 20, 30.

Question 11. Swap adjacent values

Asked in: GATE 2008

The 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?

c
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;
  }
}
  • (a) 1,2,3,4,5,6,7

  • (b) 2,1,4,3,6,5,7

  • (c) 1,3,2,5,4,7,6

  • (d) 2,3,4,5,6,7,1

Answer: (b). Pairs (1,2), (3,4), (5,6) swap values, giving 2,1,4,3,6,5,7; 7 remains and links do not move.

Question 12. Complete the recursive list-size function

Asked in: GATE 2026

Consider the following code snippet in C language that computes the number of nodes in a non-empty singly linked list pointed to by the pointer variable head.

c
struct node{
    int elt;
    struct node *next;
};
int getListSize (struct node *head)
{
    if( E1 ) return 1;
    return E2;
}

Which one of the following options gives the correct replacements for the expressions E1 and E2?

  • (a) E1: head == NULL E2: 1 + getListSize(head)

  • (b) E1: head->next == NULL E2: 1 + getListSize(head->next)

  • (c) E1: head == NULL E2: 1 + getListSize(head->next)

  • (d) E1: head->next == NULL E2: 1 + getListSize(head)

Answer: (b). For 8 -> 6 -> 4 -> 2, node 2 returns 1; nodes 4, 6, 8 add one, yielding 4. Unchanged head would never stop.

The five traps to remember

  1. Scattered storage is still linear (Q1).

  2. next is not prev or an index (Q2, Q3).

  3. tail does not reveal its predecessor (Q5, Q8, Q9).

  4. O(1) insertion assumes a known position (Q7).

  5. Assignment order can detach nodes or create cycles (Q10).

Operation

Time

Representation assumption

Traverse, search or access the nth node

O(n)

Only head and forward next links are available

Insert or delete at the head

O(1)

head is known

Insert after the tail

O(1)

A separate tail pointer is known

Delete the tail

O(n)

SLL has no predecessor pointer

Insert n items in sorted order, worst case

Θ(n²)

Each insertion position is found by traversal

Practise with DSA using Java and Coding For Placements.

Answer key, score check and next practice set

1-a, 2-b, 3-b, 4-b, 5-a, 6-d, 7-c, 8-d, 9-b, 10-d, 11-b, 12-b

At 10-12, revise edge cases. At 7-9, redraw Q5, Q8, Q9, Q10. Below 7, rebuild the model.

Review Coding & DSA, then solve stacks and queues and hashing. Draw pointers before checking.