• +91 9971497814
  • info@interviewmaterial.com

Data structure Interview Questions Answers

Data structure Interview Questions Answers

Question - 1 : - When can you tell that a memory leak will occur?

Answer - 1 : - A memory leak occurs when a program loses the ability to free a block of dynamically allocated memory.

Question - 2 : - How many parts are there in a declaration statement?

Answer - 2 : - There are two main parts, variable identifier and data type and the third type is optional which is type qualifier like signed/unsigned.

Question - 3 : - Is Pointer a variable?

Answer - 3 : - Yes, a pointer is a variable and can be used as an element of a structure and as an attribute of a class in some programming languages such as C++, but not Java. However, the contents of a pointer is a memory address of another location of memory, which is usually the memory address of another variable, element of a structure, or attribute of a class.

Question - 4 : - What is a spanning Tree?

Answer - 4 : - A spanning tree is a tree associated with a network. All the nodes of the graph appear on the tree once. A minimum spanning tree is a spanning tree organized so that the total edge weight between nodes is minimized.

Question - 5 : - What member function places a new node at the end of the linked list?

Answer - 5 : - The appendNode() member function places a new node at the end of the linked list. The appendNode() requires an integer representing the current data of the node.

Question - 6 : - What is a queue ?

Answer - 6 : - A Queue is a sequential organization of data. A queue is a first in first out type of data structure. An element is inserted at the last position and an element is always taken out from the first position.

Question - 7 : - What is the data structures used to perform recursion?

Answer - 7 : - Stack. Because of its LIFO (Last In First Out) property it remembers its caller, so knows whom to return when the function has to return. Recursion makes use of system stack for storing the return addresses of the function calls. Every recursive function has its equivalent iterative (non-recursive) function. Even when such equivalent iterative procedures are written, explicit stack is to be used.

Question - 8 : - What is the easiest sorting method to use?

Answer - 8 : - The answer is the standard library function qsort(). It's the easiest sort by far for several reasons: It is already written. It is already debugged. It has been optimized as much as possible (usually). Void qsort(void *buf, size_t num, size_t size, int (*comp)(const void *ele1, const void *ele2));

Question - 9 : - What is precision?

Answer - 9 : - Precision refers the accuracy of the decimal portion of a value. Precision is the number of digits allowed after the decimal point.

Question - 10 : - Which process places data at the back of the queue?

Answer - 10 : - Enqueue is the process that places data at the back of the queue.

Data structure Contributors


Share your email for latest updates


Our partners