Data Structure interview questions
893 questions. Tap “Show answer” to check yourself.
-
When is insertion sort a good choice for sorting an array?
- The array has only a few elements out of place
- Each element of array requires a small amount of memory
- The processor speed is fast
- Each element of array requires a large amount of memory
Show answer
A. The array has only a few elements out of place
-
A binary tree in which all its levels except the last, have maximum numbers of nodes, and all the nodes in the last level have only one child it will be its left child. Name the tree.
- Threaded tree
- Complete binary tree
- M-way search tree
- Full binary tree
Show answer
B. Complete binary tree
-
Which of following data structure is more appropriate for implementing quick sort iteratively?
- Deque
- Queue
- Stack
- Priority queue
Show answer
C. Stack
-
The number of edges in a complete graph of n vertices is
- n(n+1)/2
- n(n-1)/2
- n2/2
- n
Show answer
B. n(n-1)/2
-
If two trees have same structure and but different node content, then they are called ___
- Synonyms trees
- Joint trees
- Equivalent trees
- Similar trees
Show answer
D. Similar trees
-
If two trees have same structure and node content, then they are called ____
- Synonyms trees
- Joint trees
- Equivalent trees
- Similar trees
Show answer
C. Equivalent trees
-
A vertex of in-degree zero in a directed graph is called a/an
- Root vertex
- Isolated vertex
- Sink
- Articulation point
Show answer
C. Sink
-
A graph is a tree if and only if graph is
- Directed graph
- Contains no cycles
- Planar
- Completely connected
Show answer
B. Contains no cycles
-
An index is a pair of elements comprising key and a file pointer or record number. A file in which indices are is known as ____
- Index file
- Sort file
- Key file
- None of above
Show answer
A. Index file
-
A data item that can be used to distinguish between two entities (records) is known as
- Alternate key
- Primary key
- Primary data item
- Unique data item
Show answer
B. Primary key
-
A data structure whose elements form a sequence is known as
- Heterogeneous data structure
- Homogeneous data structure
- Linear data structures
- Non- linear data structure
Show answer
C. Linear data structures
-
Which of the following data structure is used to represent hierarchical relationship among its elements?
- Queue
- Hash table
- Tree
- Graph
Show answer
C. Tree
- Advertisement
-
Which of the following statements about a binary tree is not correct?
- Every binary tree has at least one node
- Every non-empty tree has exactly one root node
- Every node has at most two children
- Every non-root node has exactly one parent
Show answer
A. Every binary tree has at least one node
-
The average case complexity of quick sort for sorting n numbers is
- O(n2)
- O(nlog2n)
- O(n)
- O(log2n)
Show answer
B. O(nlog2n)
-
A dequeue operation removes an element
- From the front of the queue
- From any place in the queue
- From the rear of the queue
- None of above
Show answer
A. From the front of the queue
-
What is the minimum number of nodes in a complete binary tree with depth 3?
- 4
- 5
- 6
- 7
Show answer
A. 4
-
What is the number of nodes in a full binary tree with depth 3?
- 5
- 6
- 7
- 8
Show answer
C. 7
-
Which of the following operation is not supported by a queue?
- Inserting element at rear
- Removing element from front
- Removing element from middle
- None of above
Show answer
C. Removing element from middle
-
Which of the following piece of information does the data type to the compiler provide?
- The way the data is to be interpreted
- Range of values
- Amount of memory a data element uses
- All of above
Show answer
D. All of above
-
The elements of a linked list are stored
- In a structure
- In an array
- Anywhere the computer has space for them
- In contiguous memory locations
Show answer
C. Anywhere the computer has space for them
-
A parentheses checker program would be best implemented using
- List
- Queue
- Stack
- Any of the above
Show answer
C. Stack
-
To perform level-order traversal on a binary tree, which of the following data structure will be required?
- Hash table
- Queue
- Binary search tree
- Stack
Show answer
B. Queue
-
Which of the following data structure is required to convert arithmetic expression in infix to its equivalent postfix notation?
- Queue
- Linked list
- Binary search tree
- None of above
Show answer
D. None of above
-
An enqueue operation adds an element
- At any position in the queue
- To the front of the queue
- To the rear of the queue
- None of above
Show answer
C. To the rear of the queue
- Advertisement
-
Which of the following is not an entity?
- Book
- Student
- Employee
- Roll number
Show answer
D. Roll number
-
What kind of list is best to answer many questions such as “what is the item at position n?”
- Singly-linked lists
- Doubly-linked lists
- Lists implemented with an array
- Circular- linked lists
Show answer
C. Lists implemented with an array
-
Which of following operations are generally not performed on report files?
- Updation
- Maintenance
- Retrieval
- All of above
Show answer
D. All of above
-
Name the tree in which, for every node, the height of left sub tree and height of right sub tree can differ by at most one
- AVL tree
- B-tree
- Threaded tree
- Complete tree
Show answer
A. AVL tree
-
Which of the following statements about a binary tree is correct?
- No binary tree is both complete and full
- Every full binary tree is also a complete binary tree
- Every complete binary tree is also a full binary tree
- Every binary tree is either complete or full
Show answer
B. Every full binary tree is also a complete binary tree
-
What is the worst-case time for binary search finding a single item in an array?
- Quadratic time
- Linear time
- Logarithmic time
- Constant time
Show answer
C. Logarithmic time