A list of top frequently asked Data Structure interview questions and answers are given below.
1) What is Data Structure? Explain.
Data structure is a way that specifies how to organize and manipulate the data. It also specifies the relationship between them. It provides some algorithms to make data access more efficient and easy.
2) In which areas data structures are applied extensively?
Data structures are applied extensively in the following areas of computer science:
- Compiler Design,
- Operating System,
- Database Management System,
- Statistical analysis package,
- Numerical Analysis,
- Artificial Intelligence,
3) What is the difference between file structure and storage structure?
Difference between file structure and storage structure:
The main difference between file structure and storage structure is based on memory area that is being accessed.
Storage structure: When we deal with the structure that resides in the main memory of the computer system, known as the storage structure.
File structure: When we deal with an auxiliary structure then it is referred as file structures.
4) Which data structures are used with the following areas: RDBMS, Network data model and hierarchical data model?
- RDBMS uses Array data structure
- Network data model uses Graph
- Hierarchal data model uses Trees
5) What are Binary trees?
A Binary Tree is a type of data structure that has two nodes: A left node and a right node. In programming, binary trees are actually an extension of the linked list structures.
6) What is a Stack?
A stack is a data structure in which only the top element can be accessed. As data is stored in the stack, each data is pushed downward, leaving the most recently added data on top.
7) What is a multidimensional array?
A multidimensional array stores data in multiple indexes. It is used when the storing data that cannot be represented using a single dimensional indexing, such as data representation in a board game, tables with data stored in more than one column.
8) What is a linked list in data structure?
A linked list is a sequence of nodes in which each node is connected to the node following it. It makes a chain like link of data storage.
9) If you are using C language to implement the heterogeneous linked list, what pointer type should be used?
The heterogeneous linked list contains different data types, so it is not possible to use ordinary pointers for this. For this work, you have to use a generic pointer type like void pointer because void pointer is capable of storing pointer to any type.
10) How many minimum numbers of queues are needed to implement the priority queue?
Two queues are needed. One queue is used for actual storing of data and another for storing priorities.
11) Which data structure is used to perform recursion?
Stack is used to perform recursion because of its LIFO (Last In First Out) property. It knows whom to return when the function has to return.
12) When should you use binary search engine?
A binary search algorithm is used to search a list when the elements are already in order or sorted. The list starts searching in the middle, if the middle value is not the target search key, it will check to see if it will continue the search on the lower half of the list or the higher half. The split and search will then continue in the same manner.
13) How to reference all the elements in a one-dimension array?
It can be done by using an indexed loop such that the counter runs from 0 to the array size minus one. By this manner, you can reference all the elements in sequence by using the loop counter as the array subscript.
14) Which notations are used in Evaluation of Arithmetic Expressions using prefix and postfix forms?
Polish and Reverse Polish notations.
15) Give some example of the application of Tree-data structure?
Application of Tree- data structure:
- The manipulation of Arithmetic expression,
- Symbol Table construction,
- Syntax analysis
16) Give the example of some applications that make use of Multilinked Structures?
- Sparse matrix,
- Index generation.
17) Are linked lists considered linear or non-linear data structures?
A linked list is considered both linear and non-linear data structure depending on the situation.
- On the basis of data storage, it is considered as non-linear data structure.
- On the basis of access strategy, it is considered as linear data-structure.
18) What is the difference between NULL and VOID?
- Null is actually a value, whereas Void is a data type identifier.
- A null variable simply indicates an empty value, whereas void is used to identify pointers as having no initial size.
19) What is the difference between PUSH and POP?
PUSH and POP operations specify how data is stored and retrieved in a stack.
PUSH: PUSH specifies that data is being “pushed” into the stack.
POP: POP specifies data retrieval, and in particular refers to the topmost data being accessed.
20) What is a postfix expression?
An expression which each operator follows its operand is known as postfix expression. The main benefit of this form is that there is no need to group sub-expressions in parentheses or to consider operator precedence.