This set of Data Structure Interview Questions and Answers for freshers focuses on “Singly Linked Lists Operations

1. Which of the following points is/are not true about Linked List data structure when it is compared with an array?
a) Arrays have better cache locality that can make them better in terms of performance
b) It is easy to insert and delete elements in Linked List
c) Random access is not allowed in a typical implementation of Linked Lists
d) Access of elements in linked list takes less time than compared to arrays

Explanation: To get to an element in a linked list, we must go through all of the elements until we find the one we want. Because arrays provide random access to their elements, this will take longer.
2. What does the following function do for a given Linked List with first node as head?

{
return;
}
a) Prints all nodes of linked lists
b) Prints all nodes of linked list in reverse order
c) Prints alternate nodes of Linked List
d) Prints alternate nodes in reverse order

Explanation: fun1() prints the given Linked List in reverse manner.
For Linked List 1->2->3->4->5, fun1() prints 5->4->3->2->1.
3. Which of the following sorting algorithms can be used to sort a random linked list with minimum time complexity?
a) Insertion Sort
b) Quick Sort
c) Heap Sort
d) Merge Sort

Explanation: For linked lists, both Merge sort and Insertion sort can be utilised. Because of a linked list’s slow random-access performance, other algorithms (such as quicksort) perform badly, and others (such as heapsort) are impossible. Merge Sort is recommended over Insertion Sort because its worst-case time complexity is O(nLogn) whereas Insertion Sort is O(n2).

4. What kind of linked list is best to answer questions like “What is the item at position n?”
d) Array implementation of linked list

Explanation: By containing the index value in square brackets, arrays allow for random access to elements. We must go over each element in the linked list until we reach the nth position. Having an element represented in an array takes less time than accessing an element represented in a singly, doubly, or circular linked list. As a result, the item at position n is accessed using array implementation.
5. Linked lists are not suitable for the implementation of ___________
a) Insertion sort
c) Polynomial manipulation
d) Binary search

Explanation: It cannot be implemented using linked lists.
6. Linked list is considered as an example of ___________ type of memory allocation.
a) Dynamic
b) Static
c) Compile time
d) Heap

Explanation: As memory is allocated at the run time.
7. In Linked List implementation, a node carries information regarding ___________
a) Data