Data Structure Interview Questions & Answers

Showing 10 of 108 questions | Page 9

Technical interview questions and answers are the foundation of any Data Structure Interview because companies use DSA to test your problem-solving ability, logic building, and coding efficiency. Data Structures such as arrays, linked lists, stacks, queues, trees, and graphs form the backbone of programming, making this topic one of the most important parts of technical rounds. In campus placements and company-specific interviews conducted by TCS, Infosys, Wipro, Cognizant, and Capgemini, these questions decide whether a candidate has strong fundamentals. This guide covers the most important and frequently asked Data Structure interview questions with clear explanations, helping freshers and job seekers understand concepts easily. Preparing these questions improves performance in coding tests, whiteboard interviews, and online assessments.

Computer science professionals should complement their algorithmic knowledge with C language  implementation and Java programming  techniques 

Showing 10 of 108 questions

81. What is dangling pointer and how to avoid it?

After a call to free(p) makes a subsequent reference to *p illegal, i.e. though the storage to p is freed but the value of p(address) remain unchanged .so the object at that address may be used as the value of *p (i.e. there is no way to detect the illegality).Here p is called dangling pointer. To avoid this it is better to set p to NULL after executing free(p).The null pointer value doesnt reference a storage location it is a pointer that doesnt point to anything.

82. What are the disadvantages of linear list?

i) We cannot reach any of the nodes that precede node (p) ii) If a list is traversed, the external pointer to the list must be persevered in order to reference the list again

83. Define circular list?

In linear list the next field of the last node contain a null pointer, when a next field in the last node contain a pointer back to the first node it is called circular list. Advantages From any point in the list it is possible to reach at any other point

84. What are the disadvantages of circular list?

i) We cant traverse the list backward ii) If a pointer to a node is given we cannot delete the node

85. Define double linked list?

It is a collection of data elements called nodes, where each node is divided into three parts i) An info field that contains the information stored in the node ii) Left field that contain pointer to node on left side iii) Right field that contain pointer to node on right side

86. Is it necessary to sort a file before searching a particular item ?

If less work is involved in searching a element than to sort and then extract, then we dont go for sort If frequent use of the file is required for the purpose of retrieving specific element, it is more efficient to sort the file. Thus it depends on situation.

87. What are the issues that hamper the efficiency in sorting a file?

The issues are i) Length of time required by the programmer in coding a particular sorting program ii) Amount of machine time necessary for running the particular program iii)The amount of space necessary for the particular program .

88. Calculate the efficiency of sequential search?

The number of comparisons depends on where the record with the argument key appears in the table If it appears at first position then one comparison If it appears at last position then n comparisons Average=(n+1)/2 comparisons Unsuccessful search n comparisons Number of comparisons in any case is O (n).

89. Is any implicit arguments are passed to a function when it is called?

Yes there is a set of implicit arguments that contain information necessary for the function to execute and return correctly. One of them is return address which is stored within the functions data area, at the time of returning to calling program the address is retrieved and the function branches to that location.

90. Parenthesis is never required in Postfix or Prefix expressions, why?

Parenthesis is not required because the order of the operators in the postfix /prefix expressions determines the actual order of operations in evaluating the expression
Questions and Answers for Competitive Exams Various Entrance Test