Linked List MCQ Quiz in తెలుగు - Objective Question with Answer for Linked List - ముఫ్త్ [PDF] డౌన్లోడ్ కరెన్
Last updated on Mar 8, 2025
Latest Linked List MCQ Objective Questions
Top Linked List MCQ Objective Questions
Linked List Question 1:
In single linked list data structure, last element points to _________.
Answer (Detailed Solution Below)
Linked List Question 1 Detailed Solution
A linked list is a data structure used for storing collections of data. A linked list has the following properties.
- Successive elements are connected by pointers
- The last element points to NULL
- Can grow or shrink in size during execution of a program
- Can be made just as long as required
Linked List Question 2:
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?
Answer (Detailed Solution Below)
Linked List Question 2 Detailed Solution
Enquene: Inserting new node in front.
next = Head
Head = P
Hence two-pointer operations will take O(1) time.
Dequeue:
As the list is singly linked, we have to traverse up to the second last node for pointer manipulation, which will take O(n) time.
Enqueue:
Create a Node P.
P-->Data = Data
P-->Next = Head
Head = P
Complexity = Only pointer manipulatuon so constant = O(1)
Dequeue:temp = head;
While( temp-Next-->Next != NULL)
{
temp = temp-Next;
}
temp-->next = NULL;
Tail = temp;
Complexity = Traversing list and then free last node and keep track of Tail pointer = O(n)
Linked List Question 3:
What would be the contents of the list if the following function is invoked ?
void myfun (struct node *head)
{
struct node * p, * q ;
int temp ;
if (! head || ! head → next)
return ;
p = head ; q = head → next ;
while (q) {
temp = p → data ;
p → data = q → data ;
q → data = temp ;
p = q → next ;
q= p ?p->next :0
}
}
Answer (Detailed Solution Below)
Linked List Question 3 Detailed Solution
Linked List Question 4:
Separate chaining involves storing collided elements in separate data structures, typically in:
Answer (Detailed Solution Below)
Linked List Question 4 Detailed Solution
The correct answer is Linked lists
Key Points
- Linked lists:
- In separate chaining, when a collision occurs (i.e., multiple keys hash to the same index), the collided elements are stored in a linked list at that index.
- Each node in the linked list represents a key-value pair that hashed to the same location.
- This allows for efficient handling of collisions, as elements with the same hash can coexist in the same index by forming a linked list.
Additional Information
- Arrays:
- While it's possible to use arrays for separate chaining, it's less common because arrays have a fixed size, and dealing with collisions may involve resizing the array, which can be less efficient.
- If an array is used, each index might store a dynamic array or another data structure to hold collided elements.
- Stacks:
- Stacks are not typically used for separate chaining in hash tables.
- The nature of stacks (last in, first out) does not align well with the requirements of a hash table, where you need quick access and retrieval of elements.
- Queues:
- Similar to stacks, queues are not commonly used for separate chaining.
- Queues follow a first in, first out order, which doesn't provide the optimal structure for handling collisions in a hash table.
Linked List Question 5:
The efficient data structure to insert/delete a number in a stored set of numbers is
Answer (Detailed Solution Below)
Linked List Question 5 Detailed Solution
Key Points Doubly linked list:
A doubly linked list is a linked data structure that consists of a set of sequentially linked records called nodes. Each node contains three fields: two link fields and one data field.
To insert and delete the elements in a doubly linked list in random order will work efficiently as there is no traversal performed to search the correct order for the newly inserted element.
Binary tree:
A binary tree is a tree data structure in which each node has at most two children, which are referred to as the left child and the right child.
Linked list:
A linked list is a linear collection of data elements whose order is not given by their physical placement in memory. Instead, each element points to the next. It is a data structure consisting of a collection of nodes that together represent a sequence.
Queue:
A queue is a collection of entities that are maintained in a sequence and can be modified by the addition of entities at one end of the sequence and the removal of entities from the other end of the sequence.
A Doubly linked list is the efficient data structure to insert/delete a number in a stored set of numbers.
Data Structure | Worst-case time complexity | ||
Search | Insert | Delete | |
Doubly linked list | O(n) | O(1) | O(1) |
linked list | O(n) | O(1) | O(n) |
Binary tree | O(n) | O(n) | O(n) |
Queue | O(n) | O(1) | O(1) |
Hence the correct answer is the Doubly linked list.
Linked List Question 6:
In a circularly linked list organization, insertion of a record involves the modification of
Answer (Detailed Solution Below)
Linked List Question 6 Detailed Solution
Circular linked list:
In singly linked lists and doubly linked lists, the end of lists is indicated with a NULL value. But circular linked lists do not have ends. In circular linked lists, each node has a successor, and the last node points to the first node instead of NULL.
Example
Let x be a variable pointer and head.
Head is the pointer of the circular linked list.
Now to insert a new record (node) y, we have to loop through the linked list from the head to the last node like this pseudocode below.
x=head
while(x->next!=head)
{
x=x->next;
}
After finishing the loop x is now the last node and we will append the list. y is the next node of x Then the next of y will have to point to the head since the linked list is circular. The pseudocode for this task is below.
x->next=y;
y->next=head;
So There needs modification of two pointers.
So the correct answer is Option 3
Linked List Question 7:
Which of the following is the correct declaration of linked list?
Answer (Detailed Solution Below)
struct node
{
int data;
struct node *link;
}
Linked List Question 7 Detailed Solution
Declaration syntax: For structure in C and C++
struct tag_name
{
Datatype variable_name;
struct tag_name *pointer_variable;
};
Option 2:
struct node
{
int data;
struct node*link;
}
Linked List Question 8:
Consider the following statements:
(i) Inserting a new element in an array of elements is expensive than in a linked list.
(ii) Arrays have better cache locality than linked list.
(iii) Array allows random access but list does not.
Which of the above statement/s is/are TRUE?
Answer (Detailed Solution Below)
Linked List Question 8 Detailed Solution
- Inserting element in array will take O(n) time while in linked list it will take O(1). Therefore inserting a new element in an array of elements is expensive than in a list.
- Element in array are stored in contiguous memory location but not in linked list and hence arrays have better cache locality than a linked list.
- Since element in array are stored in contiguous memory location they can be accessed randomly using their index but not in linked list.
Linked List Question 9:
How many pointers are contained as data members in the nodes of a circular, doubly linked list of integers with five nodes?
Answer (Detailed Solution Below)
Linked List Question 9 Detailed Solution
Ans: The correct answer is option 4
Concept:
Circular, Doubly linked list:
We create a node a node which stores three things
Prev |
Data |
Next |
- Prev is a pointer that points to the previous node
- Data is an element of the list.
- Next is a pointer that points to the Next node
- Prev pointer of the first node points to last node and next pointer of the last node points to start node
EXPLANATION:
prev pointers are P1, P2, P3, P4, P5
Next Pointers are N1, N2, N3, N4, N5
so total 10 pointers are present in a circular, doubly linked list
Linked List Question 10:
A circular list can be used to represent
Answer (Detailed Solution Below)
Linked List Question 10 Detailed Solution
The correct option is (3)
Concept:-
Queue:- A circularly linked list is used to represent a Queue. A single variable p is used to access the queue. Linked lists provide the facility of dynamic memory allocation so it is easy to create. When we implement a circular queue using a linked list it is similar to circular linked list except there is two pointer front and rear in circular queue whereas a circular linked list has only one pointer head.
There are four different types of queues:
- Simple queue
- Circular queue
- priority queue
- Double-ended queue
Key Points
- A queue is a linear data structure that follows a particular order in which the operations are performed.
- A queue is a container of objects that are inserted and removed according to the first-in-first-out (FIFO) principle.
- A queue in C is basically a linear data structure to store and manipulate the data elements.
Additional Information Graph:- A graph is a non-linear data structure consisting of nodes and edges. It is a collection of nodes that have data and are connected to other nodes.
Stack:- A stack is an abstract data type that holds an ordered, linear sequence of items. In contrast to a queue, a stack is a last-in-first-out (LIFO) structure.
Tree:- A tree is a non-linear data structure, compared to arrays, linked lists, stacks, and queues which are linear data structures. A tree is a connected acyclic undirected graph.