# Data structure/Data Structure Questions and Answers â€“ Singly Linked Sample Test,Sample questions

## Question: ``` What would be the asymptotic time complexity to insert an element at the front of the linked list (head is known)? ```

1.O(1)

2.O(n)

3.O(n2)

4.O(n3)

Posted Date:-2021-10-25 16:29:09

## Question: ``` A linear collection of data elements where the linear node is given by means of pointer is called? ```

2. Node list

3.Primitive list

4.Unordered list

Posted Date:-2021-10-25 16:29:09

## Question: ``` Consider the following definition in c programming language. struct node { int data; struct node * next; } typedef struct node NODE; NODE *ptr; Which of the following c code is used to create new node? ```

1. ptr = (NODE*)malloc(sizeof(NODE));

2.ptr = (NODE*)malloc(NODE);

3.ptr = (NODE*)malloc(sizeof(NODE*));

4.ptr = (NODE)malloc(sizeof(NODE));

Posted Date:-2021-10-25 16:29:09

## Question: ``` Which of the following points is/are not true about Linked List data structure when it is compared with an array? ```

1.Arrays have better cache locality that can make them better in terms of performance

2.It is easy to insert and delete elements in Linked List

3.Random access is not allowed in a typical implementation of Linked Lists

4.Access of elements in linked list takes less time than compared to arrays

Posted Date:-2021-10-25 16:29:09

## Question: ``` You are given pointers to first and last nodes of a singly linked list, which of the following operations are dependent on the length of the linked list? ```

1.Delete the first element

2. Insert a new element as a first element

3. Delete the last element of the list

4. Add a new element at the end of the list

Posted Date:-2021-10-25 16:29:09

## Question: ```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 ```

1.I and II

2.I and III

3.I, II and III

4.I, II and IV

Posted Date:-2021-10-25 16:29:09

## Question: ```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? ```

1.Possible if X is not last node

2. Possible if size of linked list is eve

3. Possible if size of linked list is odd

4. Possible if X is not first node

Posted Date:-2021-10-25 16:29:09

## Question: ```In Linked List implementation, a node carries information regarding ___________ ```

1.Data

4.Node

Posted Date:-2021-10-25 16:29:09

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

1.log 2 n

2.n?2

3.log 2 n ï¿½ 1

4.n

Posted Date:-2021-10-25 16:29:09

## Question: ```Linked list data structure offers considerable saving in _____________ ```

1.Computational Time

2.Space Utilization

3.Space Utilization and Computational Time

4.Speed Utilization

Posted Date:-2021-10-25 16:29:09

## Question: ```The concatenation of two lists can be performed in O(1) time. Which of the following variation of the linked list can be used? ```

4.Array implementation of list

Posted Date:-2021-10-25 16:29:09

## Question: ```What does the following function do for a given Linked List with first node as head? void fun1(struct node* head) { if(head == NULL) return; fun1(head->next); printf("%d ", head->data); } ```

1.Prints all nodes of linked lists

2.Prints all nodes of linked list in reverse order

3.Prints alternate nodes of Linked List

4.Prints alternate nodes in reverse order

Posted Date:-2021-10-25 16:29:09

## Question: ```What is the space complexity for deleting a linked list? ```

1.O(1)

2.O(n)

3.Either O(1) or O(n)

4.O(logn)

Posted Date:-2021-10-25 16:29:09

## Question: ```What is the time complexity of inserting at the end in dynamic arrays? ```

1.O(1)

2.O(n)

3.O(logn)

4.Either O(1) or O(n)

Posted Date:-2021-10-25 16:29:09

## Question: ```What is the time complexity to count the number of elements in the linked list? ```

1.O(1)

2.O(n)

3.O(logn)

4.O(n2)

Posted Date:-2021-10-25 16:29:09

## Question: ```What kind of linked list is best to answer questions like ï¿½What is the item at position n?ï¿½ ```

Posted Date:-2021-10-25 16:29:09

## Question: ```What would be the asymptotic time complexity to add a node at the end of singly linked list, if the pointer is initially pointing to the head of the list? ```

1.O(1)

2.O(n)

3.?(n)

4.?(1)

Posted Date:-2021-10-25 16:29:09

## Question: ```What would be the asymptotic time complexity to find an element in the linked list? ```

1.O(1)

2.O(n)

3.O(n2)

4.O(n4)

Posted Date:-2021-10-25 16:29:09

## Question: ```What would be the asymptotic time complexity to insert an element at the second position in the linked list? ```

1.O(1)

2.O(n)

3.O(n2)

4.O(n3)

Posted Date:-2021-10-25 16:29:09

## Question: ```Which of the following is not a disadvantage to the usage of array? ```

1.Fixed size

2. There are chances of wastage of memory space if elements inserted in an array are lesser than the allocated size

3. Insertion based on position

4. Accessing elements at specified positions

Posted Date:-2021-10-25 16:29:09

## Question: ```Which of these is not an application of a linked list? ```

1.To implement file systems

2.For separate chaining in hash-tables

3.To implement non-binary trees

4.Random Access of elements

Posted Date:-2021-10-25 16:29:09

## More MCQS

##### R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!