• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests

Top MCQs on Linked List Data Structure with Answers

Question 21

S1 : Anyone of the followings can be used to declare a node for a singly linked list. If we use the first declaration, “struct node * nodePtr;” would be used to declare pointer to a node. If we use the second declaration, “NODEPTR nodePtr;” can be used to declare pointer to a node.

/* First declaration */
struct node {
int data;
struct node * nextPtr;
};

/* Second declaration */
typedef struct node{
int data;
NODEPTR nextPtr;
} * NODEPTR;

S2 : Anyone of the following can be used to declare a node for a singly linked list and “NODEPTR nodePtr;” can be used to declare pointer to a node using any of the following

/* First declaration */
typedef struct node
{
int data;
struct node *nextPtr;
}* NODEPTR;

/* Second declaration */
struct node
{
int data;
struct node * nextPtr;
};
typedef struct node * NODEPTR;
  • Statement S1 is true and statement S2 is false

  • Statement S1 is false and statement S2 is true

  • Both statements S1 and S2 are true

  • Neither statement S1 nor statement S2 is true

Question 22

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.

head->1->2->3->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?

  • Θ(1), Θ(1)

  • Θ(1), Θ(n)

  • Θ(n), Θ(1)

  • Θ(n), Θ(n)

Question 23

In a doubly linked list, the number of pointers affected for an insertion operation will be

  • 5

  • 0

  • 1

  • None of these

Question 24

Consider an implementation of unsorted single linked list. Suppose it has its representation with a head and a tail pointer (i.e. pointers to the first and last nodes of the linked list). Given the representation, which of the following operation can not be implemented in O(1) time ?

  • Insertion at the front of the linked list.

  • Insertion at the end of the linked list.

  • Deletion of the front node of the linked list.

  • Deletion of the last node of the linked list.

Question 25

Consider a single linked list where F and L are pointers to the first and last elements respectively of the linked list. The time for performing which of the given operations depends on the length of the linked list?

F->1->2->3->L

  • Delete the first element of the list

  • Interchange the first two elements of the list

  • Delete the last element of the list

  • Add an element at the end of the list

Question 26

The following steps in a linked list

p = getnode()
info (p) = 10
next (p) = list
list = p

result in which type of operation?

  • pop operation in stack

  • removal of a node

  • inserting a node at beginning 

  • modifying an existing node

Question 27

In DNA sequence alignment, which string-matching algorithm is commonly used to identify similarities between two DNA sequences efficiently?

  • Rabin-Karp algorithm

  • Knuth-Morris-Pratt algorithm

  • Z function

  • None of the above

Question 28

Which of the following operations is performed more efficiently by doubly linked list than by linear linked list?

  • Deleting a node whose location is given

  • Searching an unsorted list for a given item

  • Inserting a node after the node with a given location

  • Traversing the list to process each node

Question 29

The time required to search an element in a linked list of length n is

  • O (log n)

  • O (n)

  • O (1)

  • O (n2)

Question 30

The minimum number of fields with each node of doubly linked list is

  • 1

  • 2

  • 3

  • 4

There are 42 questions to complete.

Last Updated :
Take a part in the ongoing discussion