# Data Structures Quiz :- 2 (IT-c)

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
| By Harish Sharma
Harish Sharma, Computer Science
Harish is an experienced Computer Science Faculty with expertise in Artificial Intelligence, Data Structures, Image Processing, Information Retrieval, and Research. He holds a BTech in Computer Science and Engineering and a Master of Technology in ICT with a specialization in Machine Intelligence.
Quizzes Created: 2 | Total Attempts: 302
Questions: 10 | Attempts: 138

Settings

.

• 1.

### Assume a linked list has been created and start pointer is referring the first node of that linked list. select the following code that can add a new node that address hold by temp pointer, at beginning of that linked list

• A.

• B.

• C.

• D.

Explanation
The correct answer is "temp->link=start; start=temp;". This code snippet first assigns the link of the new node to the start pointer, which ensures that the new node points to the previous first node in the linked list. Then, the start pointer is updated to point to the new node, effectively adding it to the beginning of the linked list.

Rate this question:

• 2.

### Insertion of a node at the beginning of the singly linked list involves modification of

• A.

One pointer

• B.

Two pointer

• C.

Three pointer

• D.

Nothing

B. Two pointer
Explanation
When inserting a node at the beginning of a singly linked list, we need to modify two pointers. First, we need to update the "next" pointer of the new node to point to the current head of the list. This ensures that the new node is now the first node in the list. Second, we need to update the pointer of the head of the list to point to the new node. This ensures that the new node becomes the new head of the list and the rest of the list remains connected. Therefore, two pointers need to be modified in this operation.

Rate this question:

• 3.

### Assume a linked list referred by start pointer. which of the following set of statements will result into deletion of a node at position pos

• A.

• B.

• C.

• D.

Explanation
This set of statements will result in the deletion of a node at position pos. If pos is equal to 1, it means that the node to be deleted is the first node. In this case, the start pointer is updated to point to the second node, effectively removing the first node from the linked list. If pos is not equal to 1, it means that the node to be deleted is not the first node. The t1 pointer is set to point to the start pointer, and a loop is executed until i is equal to pos-1. This loop moves the t1 pointer to the node just before the node to be deleted. Finally, the link of the t1 pointer is updated to skip over the node to be deleted, effectively removing it from the linked list.

Rate this question:

• 4.

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

• A.

Possible if size of linked list is even

• B.

Possible if size of linked list is odd

• C.

Possible if X is not last node. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X.

• D.

Possible if X is not first node. Use following two steps (a) Copy the data of next of X to X. (b) Delete next of X.

A. Possible if size of linked list is even
• 5.

### Which of the following points is/are true about Linked List data structure when it is compared with 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.

All of the mentioned

D. All of the mentioned
Explanation
The statement "All of the mentioned" is the correct answer because all three points mentioned in the options are true about the Linked List data structure when compared with an array. Arrays have better cache locality, meaning that accessing elements in an array is faster due to their contiguous memory allocation. It is easier to insert and delete elements in a Linked List because it involves adjusting pointers, whereas in an array, it requires shifting elements. Lastly, random access is not allowed in a typical implementation of Linked Lists, as elements can only be accessed sequentially by following the pointers.

Rate this question:

• 6.

### What is the output of following function for start pointing to first node of following linked list?1->2->3->4->5->6void fun(struct node* start){ if(start==NULL)  return;  while(start->link!=NULL)  {  printf("%d ",(start->link)->info);  start=start->link;  } }

• A.

1 2 3 4 5 6

• B.

2 3 4 5 6

• C.

2 3 4 5

• D.

1 2 3 4 5

B. 2 3 4 5 6
Explanation
The function starts by checking if the start node is NULL. If it is, the function returns. Otherwise, it enters a while loop that continues as long as the link of the current node is not NULL. Inside the loop, it prints the info of the next node and updates the start pointer to point to the next node. This process continues until the end of the linked list is reached. Therefore, the output of the function for the given linked list would be "2 3 4 5 6".

Rate this question:

• 7.

### What is the change in linked list after execution of the following code?start:- points to first node of linkedstart->info=start->link->info;

• A.

The values of first node and second node will be same

• B.

The value of first node will be copied into second node

• C.

The value of three node will be copied into first node

• D.

No change

A. The values of first node and second node will be same
Explanation
The code is assigning the value of the first node to the second node. Therefore, after executing the code, the values of the first and second nodes will be the same.

Rate this question:

• 8.

• A.

Linear data structure

• B.

Non linear data structure

• C.

Dynamic data structure

• D.

None

A. Linear data structure
Explanation
The given answer is "Linear data structure" because a linked list is a type of data structure where each element is connected to the next element through a pointer. It maintains a linear order of elements and allows sequential access to its elements. This makes it a linear data structure.

Rate this question:

• 9.

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

• A.

Delete the first element

• B.

Insert a new element as a first element

• C.

Delete the last element of the list

• D.

Add a new element at the end of the list

C. Delete the last element of the list
Explanation
The operation of deleting the last element of the list is dependent on the length of the linked list. If the linked list has only one element, deleting the last element would result in an empty list. However, if the linked list has more than one element, deleting the last element would require traversing the entire list to reach the second-to-last element and update its next pointer. Therefore, the length of the linked list affects the complexity and feasibility of deleting the last element.

Rate this question:

• 10.

### Binary search is possible in Linked list

• A.

True

• B.

False

B. False
Explanation
Binary search is not possible in a linked list because in order to perform binary search, we need random access to elements, which is not possible in a linked list. In a linked list, we can only access elements one by one starting from the head node. Binary search requires accessing the middle element of a sorted list, which is not feasible in a linked list. Therefore, the correct answer is False.

Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

• Current Version
• Apr 12, 2024
Quiz Edited by
ProProfs Editorial Team
• Aug 31, 2017
Quiz Created by
Harish Sharma

Related Topics