0% found this document useful (0 votes)
33 views

Data Structure Lab

1. The document discusses various data structure concepts and provides definitions for terms like binary trees, linked lists, queues, stacks, graphs, and hash tables. It also answers questions on postfix notation, priority queues, sequential search, and recursion. 2. Key data structures discussed include stacks, queues, linked lists, trees, and graphs. Operations on stacks like push, pop and peek are defined. Queue is described as a first-in first-out data structure. 3. Search algorithms like breadth-first search (BFS) and depth-first search (DFS) are mentioned along with the data structures they use - queues for BFS and stacks for DFS. Other concepts covered are hashing,
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
33 views

Data Structure Lab

1. The document discusses various data structure concepts and provides definitions for terms like binary trees, linked lists, queues, stacks, graphs, and hash tables. It also answers questions on postfix notation, priority queues, sequential search, and recursion. 2. Key data structures discussed include stacks, queues, linked lists, trees, and graphs. Operations on stacks like push, pop and peek are defined. Queue is described as a first-in first-out data structure. 3. Search algorithms like breadth-first search (BFS) and depth-first search (DFS) are mentioned along with the data structures they use - queues for BFS and stacks for DFS. Other concepts covered are hashing,
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 94

DATA STRUCTURES FAQ’S

QUESTIONS ANSWER
1. Write the postfix form of the expression: (A + B) * (C - D) AB+CD-*
2. What is the maximum number of nodes in a binary tree of 2k+1-1 where k >= 1
height k?
3. Queue data structure
Which data structure suits the most in the tree construction?

4. Write the syntax in C to create a node in the singly linked list.


struct node
{
int data;
struct node *next;
};
struct node *head, *ptr;
ptr = (struct node *)malloc(sizeof(struct nod
e));

5. When can you tell that a Memory Leak will occur? A memory leak occurs when a program does
not free a block of memory allocated
dynamically.
6. What is a queue? A queue is a form of data structure that
induces a list of data. In this form of
structure, the old elements are removed from
one end while the new ones keep getting
added to the other end.
7. What is a linked list? A linked list is a sequence of nodes in which
each node is connected to the node following
it. This forms a chain-like link for data
storage.
8. What are binary trees? A binary tree is one type of data structure
that has two nodes, a left node, and a right
node. In programming, binary trees are an
extension of the linked list structures.
9. What is a graph? A graph is one type of data structure that
contains a set of ordered pairs. These
ordered pairs are also referred to as edges or
arcs and are used to connect nodes where
data can be stored and retrieved.
10. What is an algorithm? An algorithm is a step by step method of solving
a problem or manipulating data. It defines a set
of instructions to be executed in a certain order
to get the desired output.
DATA STRUCTURES FAQ’S

11. What is a Dequeue? It is a double-ended queue, or a data


structure, where the elements can be inserted
or deleted at both ends (FRONT and
REAR).
12. What is a priority queue? The priority queue is a data structure in
which the intrinsic ordering of the elements.
13. What Is Sequential Search? In sequential search each item in the array is
compared with the item being searched until
a match occurs. It is applicable to a table
organized either as an array or as a linked
list.
14. Which data structure is used to perform recursion? Stack data structure is used in recursion due
to its last in first out nature. Operating
system maintains the stack in order to save
the iteration variables at each function call
15. What are the operations that can be performed on a stack? o Push Operations
o Pop Operations
o Peek Operations

16. Write the stack overflow condition. Overflow occurs when top = Maxsize -1

17. What is a postfix expression? An expression in which operators follow the


operands 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.

The expression "a + b" will be represented


as "ab+" in postfix notation.
18. Define the queue data structure. A queue can be defined as an ordered list
which enables insert operations to be
performed at one end called REAR and
delete operations to be performed at another
end called FRONT.
19. What is the minimum number of queues that can be used to Two queues are needed. One queue is used
implement a priority queue? to store the data elements, and another is
used for storing priorities.

20. Which data structures are used in BFS and DFS algorithm? o In BFS algorithm, Queue data
structure is used.
o In DFS algorithm, Stack data
DATA STRUCTURES FAQ’S

structure is used.

21. What is Data? Data is a raw material for data processing. It


refers to unprocessed information.
22. What is information? It is the data that has been processed in the
meaningful form to the one who receives it.
23. What is Hashing? Hashing is the process of mapping a given
value with a particular key for faster access
of elements. Efficiency of mapping depends
of the efficiency of the hash function used.
24. Explain Greedy algorithm? Algorithms following greedy approach build
up solution step by step. It is mostly used in
optimization problems. It makes optimal
choice at each step, to solve entire
problem.Example: Dijikstra Algo, Prim’s
Algo, Kruskal.

25. Explain Dynamic Programming? DP is used to find the most optimized


solution by eliminating the standard
recursive calls. Example: Finding fibonacci
series.

26. What are the parameters that are cared for an algorithm? Time Complexity and Space Complexity.
27. What are Abstract Datatypes? ADTs are the special datatypes constructed
from the collection of data items.

Example : Array, Linked list, Queue.

28. What is Array? Array refers to the collection of similar data


items.

Syntax – int a[10];

Here, a is the array having size 10.

29. What is peek() operation in Stack? It returns top most element of Stack.
30. What is the condition of Stack Overflow? top=n-1, where n is the number of elements
in stack.
DATA STRUCTURES FAQ’S

31. What is the basic condition to check whether a circular queue (rear+1)%size=front
is full or not?
32. What is degree of a node? It is the number of subtree(s) of a node.
33. What is the degree of a tree? It is the maximum degree of node in tree. A
node of tree with degree 0 i.e no child is
called leaf node.
34. What is the depth of a tree? It is also known as the height of a tree. It
represents the maximum level of tree.
35. Differentiate between binary tree and tree. In an ordinary tree, parent may have many
children, but a binary tree can have atmost 2
children.
36. What is the depth of binary tree with ‘n’ nodes? D = log(base 2)(n)+1
37. Explain the game of Tower of Hanoi. The Tower of Hanoi is a mathematical game
or puzzle. It consists of three rods and a
number of disks of different sizes, which can
slide onto any rod. The puzzle starts with the
disks in a neat stack in ascending order of
size on one rod, the smallest at the top, thus
making a conical shape.
38. In Tower of Hanoi game, what could be the possible number 31.
of moves for 5 disks?
39. How can we overcome drawbacks of BST? Using AVL Trees.
40. What is AVL Tree? Concept of AVL Tree was given by
Adelson, Velski, Landis. AVL trees are
height balancing BST. It checks the height
of left&right subtree and assures that
difference is not more than 1, this difference
is termed as balanced factor.
41. Define Path & cycle? Path represents the sequence of adjacent
vertices whereas a cycle represents a closed
path.
42. What is Spanning Tree? It is a subset of a graph, which has all the
vertices covered with minimum possible
number of edges. It does not have cycles and
can’t be disconnected.
43. What is MST?
MST is minimum spanning tree. It is a
spanning tree having minimum weight than
any other spanning tree in the same graph.

Example : Prims, Kruskal algorithm.


DATA STRUCTURES FAQ’S

44. What is linear searching? Linear Search is a linear time searching


technique in which a complete list/array is
traversed in order to search a element.
45. What is the best case for Binary Search? When element is present at middle position.
46. Is bubble sort stable? Yes.
47. What is the role of minheap operation in heap sort? It extracts the minimum element from heap.
48. What are multidimensional arrays? Multidimensional arrays make use of
multiple indexes to store data. It is useful
when storing data that cannot be represented
using single dimensional indexing, such as
data representation in a board game, tables
with data stored in more than one column.
49. What is FIFO? FIFO stands for First-in, First-out, and is
used to represent how data is accessed in a
queue. Data has been inserted into the queue
list the longest is the one that is removed
first.
50. What is an ordered list? An ordered list is a list in which each node’s
position in the list is determined by the value
of its key component, so that the key values
form an increasing sequence, as the list is
traversed.
51. What is merge sort? Merge sort, is a divide-and-conquer
approach for sorting the data. In a sequence
of data, adjacent ones are merged and sorted
to create bigger sorted lists. These sorted
lists are then merged again to form an even
bigger sorted list, which continues until you
have one single sorted list.
52. What is a postfix expression? A postfix expression is an expression in
which each operator follows its operands.
The advantage of this form is that there is no
need to group sub-expressions in parentheses
or to consider operator precedence.
53. What are dynamic data structures? Dynamic data structures are structures that
expand and contract as a program runs. It
provides a flexible means of manipulating
data because it can adjust according to the
size of the data.
54. Which sorting algorithm is considered the fastest? There are many types of sorting algorithms:
quick sort, bubble sort, balloon sort, radix
sort, merge sort, etc. Not one can be
considered the fastest because each
algorithm is designed for a particular data
DATA STRUCTURES FAQ’S

structure and data set. It would depend on


the data set that you would want to sort.
55. What is Huffman’s algorithm? Huffman’s algorithm is used for creating
extended binary trees that have minimum
weighted path lengths from the given
weights. It makes use of a table that contains
the frequency of occurrence for each data
element.
56. What is Fibonacci search? Fibonacci search is a search algorithm that
applies to a sorted array. It makes use of a
divide-and-conquer approach that can
significantly reduce the time needed in order
to reach the target element.
57. When can you tell that a Memory Leak will occur? A memory leak occurs when a program does
not free a block of memory allocated
dynamically.

58. Which data structure is ideal to perform recursion operation Stack is the most ideal for recursion
and why? operation. This is mainly because of its
LIFO (Last In First Out) property, it
remembers the elements & their positions, so
it exactly knows which one to return when a
function is called.

59. Convert the below given expression to its equivalent Prefix


Prefix Notation: ^ * +ABC DE + FG
And Postfix notations.
((A + B) * C - (D - E) ^ (F + G)) postfix Notation: AB + C * DE FG + ^

60. ▪ Hashmap is a data structure that uses


What is hashmap in data structure?
implementation of hash table data structure
which allows access of data in constant time
(O(1)) complexity if you have the key.

61. What is the type of the algorithm used in solving the 8 Backtracking.
Queens problem?
62. In an AVL tree, at what condition the balancing is to be If the 'pivotal value' (or the 'Height factor') is
done? greater than 1 or less than -1.
63. What is the bucket size, when the overlapping and collision One. If there is only one entry possible in the
occur at same time? bucket, when the collision occurs, there is no
way to accommodate the colliding value.
DATA STRUCTURES FAQ’S

This results in the overlapping of values.


64. What is a spanning Tree? 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.
65. Does the minimum spanning tree of a graph give the shortest No. The Minimal spanning tree assures that
distance between any 2 specified nodes? the total weight of the tree is kept at its
minimum. But it doesn't mean that the
distance between any two nodes involved in
the minimum-spanning tree is minimum.
66. Which is the simplest file structure? (Sequential, Indexed, Sequential is the simplest file structure.
Random)
67. Whether Linked List is linear or Non-linear data structure? According to Access strategies Linked list is
a linear one.
According to Storage Linked List is a Non-
linear one.

68. What is LIFO? LIFO is a short form of Last In First Out. It


refers how data is accessed, stored and
retrieved. Using this scheme, data that was
stored last should be the one to be extracted
first. This also means that in order to gain
access to the first data, all the other data that
was stored before this first data must first be
retrieved and extracted.
69. What are multidimensional arrays? Multidimensional arrays make use of
multiple indexes to store data. It is useful
when storing data that cannot be represented
using single dimensional indexing, such as
data representation in a board game, tables
with data stored in more than one column.
70. What is FIFO? FIFO stands for First-in, First-out, and is
used to represent how data is accessed in a
queue. Data has been inserted into the queue
list the longest is the one that is removed
first.
71. In what data structures are pointers applied? Pointers that are used in linked list have
various applications in the data structure.
Data structures that make use of this concept
include the Stack, Queue, Linked List and
Binary Tree.
72. What is the difference between storage structure and file The main difference between storage
structure and file structure depends on the
DATA STRUCTURES FAQ’S

structure? memory area that is accessed.

• Storage structure: It's a data structure


representation in computer memory.
• File structure: It's a storage structure
representation in the auxiliary
memory.

73. Name a few graph data structure applications. Applications of graph data structures in real-
time are:

• Social graphs
• Path optimization algorithms
• Recommendation engines
• Scientific computations

74. How do you detect a loop in a linked list? • Using Floyd's cycle-finding
Algorithm
• Using hashing
• Using the visited nodes method

75. What is the max heap in the data structure? A max heap in a data structure is a complete
binary tree where each internal node's value
is greater than or equal to that node's
children's values.
76. Some of the applications of stack are as
What are different application of stack. follows:
- Function calls.
- Reversal of a string.
- Checking validity of an expression
containing nested parenthesis.
- Conversion of infix expression to postfix.
77. The process of attempting for solving a
What is an iterative algorithm? problem which finds successive
approximations for solution, starting from an
initial guess. The result of repeated
calculations is a sequence of approximate
values for the quantities of interest.
a. Recursive algorithm is a method of
What is an recursive algorithm? simplification that divides the problem into
sub-problems of the same nature. The result
DATA STRUCTURES FAQ’S

of one recursion is the input for the next


recursion. The repletion is in the self-similar
fashion. The algorithm calls itself with
smaller input values and obtains the results
by simply performing the operations on
these smaller values. Generation of factorial,
Fibonacci number series are the examples of
recursive algorithms.
78. Different elements can be inserted into a
Is it possible to insert different type of elements in a stack? stack. This is possible by implementing
How? union / structure data type. It is efficient to
use union rather than structure, as only one
item’s memory is used at a time

79. Complexity of an algorithm can be found out


What is the method to find the complexity of an algorithm? by analyzing the resources like memory,
processor, etc. The computational time is
also used to find the complexity of an
algorithm. The running time through which
the program is processed requires the
function of the size of the input. The
complexity is measured by number of steps
that has to be executed for a particular input.
The space complexity and the time
complexity are the two main methods which
allow the user to know the complexity of the
algorithm and allow user to make it more
optimized.
80. ▪ Precision refers the accuracy of the decimal
What is precision? portion of a value.
▪ Precision is the number of digits allowed
after the decimal point.

81. ▪ In linear list the next field of the last node


Define circular list? 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.

82. When a function is called


What actions are performed when a function is called?
▪ arguments are passed
▪ local variables are allocated and initialized
DATA STRUCTURES FAQ’S

▪ transferring control to the function

83. Pool is a list consisting of unused memory


What do you mean by free pool? cells which has its own pointer.

84. A node class is a class that has added new


What is a node class? services or functionality beyond the services
inherited from its base class.

85. Dynamic memory management is a


technique in which storage units are
What is dynamic memory management? allocated based on the requirements
continuously. Using dynamic memory
allocations, individual data structures can be
either stored separately or combined to form
entities called composites. These composites
can be worked on when required.
86. Linear Data Structures Non-linear Data
Structures
State the difference between Linear and Non-linear Data
Structures. Data elements are Data elements can be
stored next to each separated by other
other entities in memory
E.g.: Arrays, linked E.g.: Trees and
lists, stacks, and graphs
queues
87. The postfix form of the given expression is
XY+ZC-*
What is the postfix form of: (X + Y) * ( Z - C)

88.
Multi-linked data structures are used in
Where are Multi-linked Data Structures used? many domains. Following are the two most
important use cases of multi-linked data
structures:

• Generation of sparse matrices


• Index creation for data entities
DATA STRUCTURES FAQ’S

89.
Inorder traversal works in the following
What is the method used for inorder traversal in trees? way:

• The tree is traversed through the left


subtree.
• The root node is visited after the left
visit.
• Then, the right subtree is traversed.

90. Void pointers are used because of their


capability to store any pointer, which is
What is the use of void pointers? pointing to a wide variety of data. It is used
to implement heterogeneous linked lists in
many programming languages.

91. Yes, an array is a linear data structure


Is an array a linear data structure? because each element is connected with the
elements before and after it.
92.
What is the default value in boolean and integer arrays? Boolean = false

Integer = 0

93. The size of a linked list is decided at runtime


What is the difference between Arrays and Linked Lists? as you add or delete elements, not during
initialization. An array’s size is fixed once
it’s initialized.
94.
What makes Singly Linked Lists unique? Singly Linked Lists are unidirectional,
meaning that they can only be traversed
from head to tail.

Each node contains data and a pointer to the


next node. The first node is the head and
points to the first element of the list while
the final tail node points to null to mark the
end of the list.

This is the opposite of a doubly linked list.


DATA STRUCTURES FAQ’S

95. This traverses the list. We store the first


What does the following fragment of code do? element of the list in currentNode and then
traverse the list until we reach the end.
Node currentNode = list.headNode;
while(currentNode != null){
currentNode = currentNode.nextNode;
}

96. They can be but do not need to. Elements of


Are elements in a linked list stored consecutively in memory? a linked list are stored with pointers meaning
they do not need to be stored next to each
other to be found. However, two elements
may be stored consecutively by random
chance.
97. String constant pool within heap memory.
Where are strings stored in memory?

98. The equals() method checks if the value


What is the difference between equals() method matches the content of the string
and == operator? while == checks if the value matches the
object or reference of the string.
99. A given problem can be solved in numerous
What is the need for algorithm analysis? ways. Hence, it is possible to derive several
solution algorithms. The purpose of
analysing algorithms is to find and
implement the most suitable algorithm.
100. For any algorithm, there are three different
What is meant by an algorithm’s asymptotic analysis? levels of execution time based on
mathematical binding:
• Representation of the Best Case is done by
the symbol Ω(n)
• Representation of the Worst-Case is done by
the symbol Ο(n)
• Representation of the Average Case is done
by the symbol Θ(n)

101. The heap data structure is a balanced binary


What is a heap data structure? tree where the root node of the tree is
compared with the child nodes while
arranging the tree. If the value of the root
node is larger than or equal to any child
node, the structure is called a Max Heap. If
DATA STRUCTURES FAQ’S

the value of the root node is lesser than or


equal to any child node, the structure is
called a Min Heap.
102. The Big O notation is a tool for analyzing an
What is Big O notation in data structure? algorithm’s execution time. This notation is
the formal way to represent the upper bound
of the respective algorithm’s running time. It
is used to access the worst case for the total
time the program will take to complete
execution.
103. Garbage collection is a memory
What is Garbage Collection in Data Structure? management method that is used for
identifying blocks of memory that are dead
or unused and reallocate them for storing
data. This can help to prevent memory leaks.
104. Hashing is a process in data structure that is
What is Hashing in Data Structure? performed through a Hash function. In this
function, data stored in a hash table is
accessed through their index values.

In a hash table each value has a unique


index. The function maps the value to be
searched with the keys for faster access or
retrieval.

105. The algorithmic complexity is calculated by


How to calculate the complexity of an algorithm in data analyzing the time taken for completion and
structure? space it consumes during its execution. If A
is the algorithm and n is the size of the input
provided to the program, time is calculated
by counting the number of operations
executed.

The maximum memory space occupied


during these operations defines the memory
space of the algorithm. For example, the
time complexity is measured using the Big O
notation.

106. The various types of algorithm in data


What are the various types of Algorithm in data structure? structure are:
DATA STRUCTURES FAQ’S

• Search, sort, insert, update delete


algorithm
• Recursive algorithm
• Backtracking algorithm
• Divide and conquer algorithm
• Randomized algorithm
• Brute force algorithm
• Dynamic algorithm
• Greedy algorithm

107. Techniques for making hash function.


What are different techniques for making hash function? - Truncation Method
- Midsquare Method
- Folding Method
- Division Method
108. The process of allocating memory at run
time is called dynamic memory allocation.
What are different dynamic memory allocation technique in
The allocation and release of this memory
C.
space can be done with the help of some
predefined function. These functions allocate
memory from a memory area called heap
and free this memory whenever not required.

The functions that are used to allocate


memory at runtime are as follows:
- malloc()
- calloc()
- realloc()
109. Following are the main difference between
What are the difference between malloc() and calloc()? malloc() and calloc().

- calloc() function takes two parameters but


malloc() function takes only one parameter.

- Memory allocated by calloc() is initialized


to zero while memory allocated by malloc()
contains garbage value
110. What are different application of stack. Some of the applications of stack are as
follows:
- Function calls.
- Reversal of a string.
- Checking validity of an expression
containing nested parenthesis.
DATA STRUCTURES FAQ’S

- Conversion of infix expression to postfix.


111. One of the applications of stack is checking
How will you check the validity of an expression containing validity of an expression containing nested
nested parentheses? parenthesis. An expression will be valid if it
satisfies the two conditions.

- The total number of left parenthesis should


be equal to the total number of right
parenthesis in the expression.
For every right parenthesis there should be a
left parenthesis of the same time.
112. This is done using an indexed loop.
How do you reference all the elements in a one-dimension - The counter runs from 0 to the array size
array? minus one.
- Using the loop counter as the array
subscript helps in referencing all the
elements in one-dimensional array.
113. A recursive function is a function that calls
Which data structure is applied when dealing with a recursive itself based on a terminating condition.
function? - It uses stack.
- Using LIFO, a call to a recursive function
saves the return address. This tells the return
address to the calling function after the call
terminates.
114. Dynamic memory allocation helps to store
How does dynamic memory allocation help in managing simple structured data types.
data? - It can combine separately allocated
structured blocks to form composite
structures that expand and contract as
required.
115. The amount of memory to be allocated
How does variable declaration affect memory allocation? depends on the data type of the variable.
- An integer type variable is needs 32 bits of
memory storage to be reserved.

116. The isEmpty() member method is called


Why is the isEmpty() member method called? during the dequeue process. It helps in
ascertaining if there exists any item in the
queue which needs to be removed.
- This method is called by the dequeue()
method before returning the front element.
DATA STRUCTURES FAQ’S

117. Binary tree consists of only fixed number of


What is the difference between B tree and Binary search tree? keys and children, whereas B tree consists of
variable number of keys and children.
Binary tree keys are stored in decreasing
order, whereas B tree consists of the keys
and children in non-decreasing order.
Binary tree doesn't consists of associated
child properties whereas B tree consists of
keys has an association with all the nodes
with the keys that are less than or equal to
the preceding key. Binary tree doesn't have
minimization factor concept, whereas B tree
has the concept of minimization factor
where each node has minimum number of
allowable children.
118. Max heap is also known as descending heap
How to sequentially represent max-heap? consisting of the objects in a heap list with
some keys. It is of size n and will be of the
form of complete binary tree that is also of
nodes n. In this max-heap each node is less
than or equal to the content of its parent.
It represents the sequential complete binary
tree with the formula to calculate as:
max[j] <= max[(j-1)/2] for 0 <= ((j-1)/2) < j
<= n-1
Max-heap contains the root element as the
highest element in the heap and from there
the descending elements will be shown on
the children node. It will also be traversed in
an orderly manner and will be accessed by
accessing the root first then their children
nodes.
119. Name the parts of the linked list. A linked is a collection of nodes where each
node except the end one point to another
node. The first node of the linked list is
known as Head and the last node is known
as Tail.
120. We perform the in-order traversal on the
How can you check a given Binary tree is a BST or not? binary tree and store each visited element in
an array and if we get a sorted array then it
would be a Binary Search tree else not.
DATA STRUCTURES FAQ’S

121. If the depth of a tree is 3 levels, then what is the size of the
Tree ?

A. 2 D. 8

B. 4

C. 6

D. 8

122. One of the following options is a form of access used to add


and remove nodes from a queue ? B. FIFO

A. LIFO

B. FIFO

C. Both LIFO and FIFO

D. Recursion

123.
In case of the worst timing, which might be the worst to A. Quick
implement in sorting algorithm ?

A. Quick

B. Merge

C. Time

D. Heap
DATA STRUCTURES FAQ’S

124. In regards to time complexity which will perform better ω(n4)


or O(n3) ?

A. ω(n4)

A. ω(n4)

B. O(n3)

C. Both Equally

D. Can't be said

125. The time required to insert in the Queue is ?

C. O(1)
A. O(n)

B. O(n2)

C. O(1)

D. O(log n)

126. Which of the following has the quickest average time


complexity ?

A. Quick B. Radix

B. Radix

C. Bubble

D. Heap
DATA STRUCTURES FAQ’S

127. In a weighted graph, a minimum spanning


What is a minimum spanning tree (MST) ? tree is a spanning tree that has minimum
weight that all other spanning trees of the
same graph.

128. Shell sort is an unstable quadratic sorting


What is shell sort? algorithm and it is a generalization of
insertion sort.

This algorithm starts by sorting pairs of


elements far apart from each other, then
progressively reducing the gap between
elements to be compared.

129. Backtracking.
Which algorithm used in solving the 8 Queens problem.

130. A complete graph is a graph with N vertices


Define a complete Graph. and an edge between every two vertices.
Given that N is positive integer, there are no
loops and every two vertices share exactly
one edge.

The symbol KN denotes a complete graph


with N vertices.

131. In graph theory and computer science, an


What is Adjacency matrix? adjacency matrix is a square matrix used to
represent a finite graph. The elements of the
matrix indicate whether pairs of vertices are
adjacent or not in the graph.
132. A digraph pr directed graph is a Data
What is a digraph in data structures? Structure containing a vertex set V and an
edge/arc set A, where each edge is an
ordered pair of vertices. The arcs may be
thought of as arrows, each one starting at
one vertex and pointing at precisely one
other.
133. A dense graph is a graph in which the
What is a dense graph? number of edges is close to the maximal
number of edges.
DATA STRUCTURES FAQ’S

134. Sparse graph is a graph in which the number


What is a sparse graph? of edges is close to the minimal number of
edges.
135. Dynamic programming also known as
What is Dynamic programming? dynamic optimization is a method for
solving a complex problem by breaking it
down into a collection of simpler
subproblems, solving each of those
subproblems just once, and storing their
solutions using a memory-based data
structure.
136. Sorting is not possible in Deletion. Using
Is sorting possible with delete operation in data structure? insertion we can perform insertion sort,
using selection we can perform selection
sort, using exchange we can perform
the bubble sort. But no sorting method can
be done just using deletion.
137. Heterogeneous Linked List is a linked list
What is heterogeneous linked list? data-structure that contains or is capable of
storing data for different datatypes.
138. Tree traversal is the process to visit all the
What is tree traversal? nodes of a tree. All the nodes are connected
via edges (links), we always start from the
root (head) node. There are three ways
which we use to traverse a tree.

• In-order Traversal,
• Pre-order Traversal,
• Post-order Traversal,

139. Time complexity of an algorithm indicates


What is the time complexity of Algorithm? the total time required by the program to run
to completion. It is usually expressed by
using the big O notation.
140. What is depth of node in a tree. Depth is the node is equal to the number of
edges to the node from root node. The depth
of root node is 0.

Also maximum number of children at level


“i” is 2 to the power of I.
DATA STRUCTURES FAQ’S

141. How to find the height of a node in a tree? The height of the node is equal to the
number of edges in the longest path to the
leaf from the node. The depth of a leaf node
is 0.

Height of the tree is nothing but the height of


the root node.

142. In a strict binary tree, each node can have


What is a strict or proper binary tree? either 0 or 2 children.

143. In complete binary tree, all level except the


Define complete and perfect binary tree. last are completely filled and all the node are
on left as possible and no vacant space on
left side.

In perfect binary tree, all levels are


completely filled.

144. Merge sort takes O (n log n) in terms of


What is the complexity of Merge sort algorithm? worst case scenario.

145. Inverted binary tree is the mirror image of


What is inverted binary tree? the tree where the left of the nodes move to
right and vice versa.
146. ▪ When a function is called arguments are
What Actions Are Performed When A Function Is Called? passed.
▪ local variables are allocated and
initialized.
▪ transferring control to the function.

147. Return address is retrieved.


What Actions Are Performed When A Function Returns? ii) Function’s data area is freed.
iii) Branch is taken to the return address.
148. When new data is to be inserted into the data
What Do You Mean By Overflow And Underflow? structure but there is no available space i.e.
free storage list is empty this situation is
called overflow. When we want to delete
data from a data structure that is empty this
situation is called underflow.
DATA STRUCTURES FAQ’S

149. ▪ Fixed amount of storage remains


What Are The Disadvantages Of Sequential Storage? allocated to the data structure even if it
contains less element.
▪ No more than fixed amount of storage
is allocated causing overflow.

150. After a call to free(p) makes a subsequent


What Is Dangling Pointer And How To Avoid It? 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
doesn’t reference a storage location it is a
pointer that doesn’t point to anything.

151. In linear list the next field of the last node


Define Circular List? 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.

152. If less work is involved in searching a


Is It Necessary To Sort A File Before Searching A Particular element than to sort and then extract, then
Item we don’t 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.

153. The number of comparisons depends on


Calculate The Efficiency Of Sequential Search? where the record with the argument key
DATA STRUCTURES FAQ’S

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).

154. Yes there is a set of implicit arguments that


Is Any Implicit Arguments Are Passed To A Function When contain information necessary for the
It Is Called? function to execute and return correctly. One
of them is return address which is stored
within the function’s data area, at the time of
returning to calling program the address is
retrieved and the function branches to that
location.
155. Parenthesis is not required because the order
Parenthesis Is Never Required In Postfix Or Prefix of the operators in the postfix /prefix
Expressions, Why? expressions determines the actual order of
operations in evaluating the expression.
156. Prefix Notation:
Convert The Expression ((a + B) * C – (d – E) ^ (f + G)) To ^ – * +ABC – DE + FG
Equivalent Prefix And Postfix Notations?
postfix Notation:
AB + C * DE – – FG + ^

157. In An Avl Tree, At What Condition The Balancing Is To Be If the ‘pivotal value’ (or the ‘Height factor’)
Done? is greater than 1 or less than –1.

158. In general: There are 2n-1 nodes in a full


There Are 8, 15, 13, 14 Nodes Were There In 4 Different binary tree. By the method of elimination:
Trees. Which Of Them Could Have Formed A Full Binary
Tree? Full binary trees contain odd number of
nodes. So there cannot be full binary trees
with 8 or 14 nodes, so rejected. With 13
nodes you can form a complete binary tree
but not a full binary tree. So the correct
answer is 15.
DATA STRUCTURES FAQ’S

159. No! Minimal spanning tree assures that the


Does The Minimal Spanning Tree Of A Graph Give The total weight of the tree is kept at its
Shortest Distance Between Any 2 Specified Nodes? minimum. But it doesn’t mean that the
distance between any two nodes involved in
the minimal-spanning tree is minimum.
160. Definitions of member functions for the
Which File Contains The Definition Of Member Functions? Linked List class are contained in the
LinkedList.cpp file.
161. RDBMS Array (i.e. Array of structures)
What Are The Major Data Structures Used In The Following Network data model Graph Hierarchical data
Areas : Rdbms, Network Data Model & Hierarchical Data model Trees.
Model?

162. The appendNode() member function places a


What Member Function Places A New Node At The End Of new node at the end of the linked list. The
The Linked List? appendNode() requires an integer
representing the current data of the node.
163. Below are the set of operations that any of
What are the commonly used data structure operations? the data structure can perform:

o Insertion: It means adding an element


to the data structure.
o Traversal: It means printing or
accessing any or all elements in the
data structure.
o Deletion: It is a removal of an
element from the data structure.
o Searching: It means searching for a
specific element in the data structure.
o Sorting: It means organising the
elements of the data structure in a
particular sequence.

164. o Prefix Notation: The operator is


Explain the prefix, postfix, and infix notations written for the operands. For
example, adding two numbers, A and
B, can be written as + AB.
o Postfix Notation: The operator is
written after the operands in Postfix
notation. For example, adding two
numbers, A and B, can be written as
AB+.
DATA STRUCTURES FAQ’S

o Infix Notation: In Infix Notation, the


operator is written between the
operands. For example, adding two
numbers, A and B, can be written
A+B.

165. Data structures have three characteristics:


What are three characteristics of Data Structure?
1. Correctness: The interface implementation
should be correct.
2. Time Complexity: Data structure
operations should have minimum execution
time.
3. Space Complexity: Data structure should
use minimum memory.
166. A linked list can be a subset of both linear
The linked list is an example of a linear or non-linear data and nonlinear, it depends on its usage &
structure? application. If it is used for access strategies,
then it is a part of linear structures but when
used for data storage, it can be called a non-
linear data structure.
167. Heap and Stack both of them are part of
Why is Heap more advantageous than Stack? memory and are often required for use in
JAVA for multiple needs: But here what
makes them incomparable:

• Heap is quite flexible compared to


stack because it can easily allocate
and deallocate the memory space.
• Stacks contained variables seem
visible only to the private owners,
while objects gathered in Heap are
visible to all threads.
• Stack memory just holds local
variables & function calls while heap
memory is used to store objects in
JAVA.
• While recursion, the stack memory
fills-ups quickly, while Heap
memory doesn’t.

168. • By Floyd’s cycle-finding algorithm


What are the 2 ways to determine whether the linked list has • By using the visited nodes method
DATA STRUCTURES FAQ’S

a loop? • By using Hashing

169. Multi linked structures are most used to


Where multilinked structures are commonly used? generate an index and sparse matrix.

170. In max heap data structures, the value of the


What is the structure of the max heap data structure? root node stands as either equal or greater to
its child nodes.
171. An array where its elements are itself arrays
What is Jagged array? of different sizes & dimensions.

172. Dynamic memory allocations carry the


How does dynamic memory allocation help with the simple data structure types during the
management of data? runtime. It helps to combine the separately
allocated blocks to turn them into a
composite structure - that could be extended
and shrunken as needed. Thus, it helps with
data blocks of arbitrary size and arbitrary
order.
173. There is a total of 6 types of trees:
List out of the types of trees.
• Tournament tree
• Expression tree
• Binary tree
• Binary search tree
• General tree
• Forests

174. • Circuit - it is a closed path where


State the difference between path, cycle, circuit. initial vertex and end vertex are
identical to each other. And any
vertex can be repeated.
• Path - They are the sequence of
adjacent vertices that are connected
by edges and have no restrictions.
• Cycle - It is also a closed path where
the initial vertex is identical to the
closed vertex but the vertex in the
path cannot be visited twice.
DATA STRUCTURES FAQ’S

175. You can use two data structures to perform


Which data structures must be used to perform LRU cache? LRU cache:

• Hash- With page number as key and


address of the corresponding queue
node as the value.
• Queue - This structure is performed
using a doubly-linked list. The
recently used pages will be found
near the REAR end and the least
recently used pages near the front
end.

176. What is Brute Force algorithm? Algorithm used to search the contents by
comparing each element of array is called
Brute Force algorithm.

177. In RDBMS, what is the efficient data structure used in the internal B+ tree. Because in B+ tree, all the data is
storage representation? stored only in leaf nodes, that makes
searching easier. This corresponds to the
records that shall be stored in leaf nodes.

178. How can you overcome the limitations of arrays? Limitations of arrays can be solved by using
the linked list.

179. What are the types of Collision Resolution Techniques and the Open addressing (closed hashing),The
methods used in each of the type? methods used include:Overflow block.
Closed addressing (open hashing),The
methods used include:Linked list,Binary
tree.
180. Mention some of the problem solving strategies? The most widely strategies are listed below:

• Divide and conquer


• Binary doubling strategy
• Dynamic programming

181. What are the limitations of arrays? • Arrays are of fixed size.
• Data elements are stored in continuous
memory locations which may not be
available always.
DATA STRUCTURES FAQ’S

• Adding and removing of elements is


problematic because of shifting the
locations.

182. What are the different types of traversing? The different types of traversing are:

• Pre-order traversal-yields prefix from of


expression.
• In-order traversal-yields infix form of
expression.
• Post-order traversal-yields postfix from of
expression.

183. What is precision? Precision refers the accuracy of the decimal


portion of a value. Precision is the number of
digits allowed after the decimal point.

184. What is meant by sorting? Ordering the data in an increasing or


decreasing fashion according to some
relationship among the data item is called
sorting.
185. What is divide and conquer method? The basic idea is to divide the problem into
several sub problems beyond which cannot
be further subdivided. Then solve the sub
problems efficiently and join then together
to get the solution for the main problem.
186. What is the need for the header? Header of the linked list is the first element
in the list and it stores the number of
elements in the list. It points to the first data
element of the list.
187. What do you mean by: Syntax Error, Logical Error, Run time Syntax Error-Syntax Error is due to lack of
Error? knowledge in a specific language. It is due to
somebody does not know how to use the
features of a language.We can know the
errors at the time of compilation.
logical Error-It is due to the poor
understanding of the requirement or
problem.
Run time Error-The exceptions like divide a
number by 0,overflow and underflow comes
under this.
DATA STRUCTURES FAQ’S

188. Is it possible to find a loop in a Linked list? Solution: a. Possible at O(n)


Have two pointers say P1 and P2 pointing to
• a. Possible at O(n) the first node of the list.
• b. Not possible Start a loop and Increment P1 once and P2
• c. Possible at O(n^2) only twice in each iteration. At any point of time
• d. Depends on the position of loop if P1==P2 then there is a loop in that linked
list. If P2 reaches NULL (end of linked list)
then no loop exists.

189.
The below-given problems find their
Give some examples greedy algorithms? solution using the greedy algorithm
approach −

Travelling Salesman Problem, Prim's


Minimal Spanning Tree Algorithm,
Kruskal's Minimal Spanning Tree
Algorithm, Dijkstra's Minimal Spanning
Tree Algorithm, Graph - Map Coloring,
Graph - Vertex Cover, Knapsack Problem,
Job Scheduling Problem.

190. Depth First Search algorithm(DFS) traverses


a graph in a depthward motion and uses a
How depth-first traversal works? stack to remember to get the next vertex to
start a search when a dead end occurs in any
iteration.

191.
Tower of Hanoi, is a mathematical puzzle
What is the tower of Hanoi? which consists of three towers (pegs) and
more than one rings. All rings are of
different size and stacked upon each other
where the large disk is always below the
small disk. The aim is to move the tower of
the disk from one peg to another, without
breaking its properties.
DATA STRUCTURES FAQ’S

192.
Explain Divide & Conquer algorithm? Algorithms following D&C approach works
in two steps-Divide & Combine. Atfirst we
divide the problem into subparts, solve them
individually and then combine the result of
all subparts to get a collective solution.

Example: Binary Search, Merge Sort.

193. Time Complexity and Space Complexity.


What are the parameters that are cared for an algorithm?

194.
What is 2D Array? 2D array or 2 dimensional array is array of
arrays. It is used to store the data in tabular
form-in the terms of rows and columns.

It is represented as int a[m][n], where m


denotes number of rows and n denotes
number of columns.

195. It returns top most element of Stack.


What is peek() operation in Stack?

196. (rear+1)%size=front
What is the basic condition to check whether a circular queue
is full or not?

197. It is the set of disjoint tree. In a tree, if you


What is Forest of a tree? remove its root node then it becomes a
forest.
198.
Explain different types of binary tree? . Full Binary tree : Every node has 0 or 2
children.

2. Complete Binary tree : All internal nodes


have 2 children.
DATA STRUCTURES FAQ’S

3. Skewed tree : Tree that goes in single


direction.

Left Skewed tree : Node have only left child


not right.

Right Skewed tree : Node have only right


child not left.

199. D = log(base 2)(n)+1


What is the depth of binary tree with ‘n’ nodes?

200. It is a particular type of optimal prefix code


Explain the concept of Huffman coding? that is used for lossless data compression. It
is an example of Greedy algorithm. It
assigns variable length code to all the
characters. The code length of a character
depends on how frequently it occurs in the
given text. The character which occurs most
frequently gets the smallest code. The
character which occurs least frequently gets
the largest code.
201. B-tree is a self-balancing tree data structure
Differentiate between B-Tree & B+ Tree? that maintains sorted data and allows
searches, sequential access, insertions, and
deletions in logarithmic time. The B-tree is a
generalization of a binary search tree in that
a node can have more than two children.

In B+ Tree, each node contains key only(not


pairs), and all pointers to data-records exists
at leaf level only.

202. 1. Left-Left Rotation (LL) : right rotate node


What are the different operations applied on AVL tree? p.

2. Left-Right Rotation (LR) : left rotate


“parent of p” and right rotate “parent of
DATA STRUCTURES FAQ’S

parent of p (p-parent-parent)”.

3. Right-Right Rotation (RR) : left rotate


node p.

4. Right-Left Rotation (RL) : right rotate


“parent of p” and left rotate “parent of parent
of p (p-parent-parent)”.

where p is the node with violating balance-


factor.

203. It is the maximum distance between a vertex


What is eccentricity? to all other vertices.

204. Dijikstra Algorithm.


Tell any one Single Source Shortest Path algorithm?

205. Inplace sorting techniques does not require


What are inplace sorting techniques, tell me one inplace and any extra space to sort a given list/array.
one non-inplace sorting technique.
Inplace Sorting – Bubble Sort

Non-inplace Sorting – Merge Sort

206. O(n^2), it happens when :


What is the worst time complexity of quick sort?
Array is already sorted in same order.

Array is already sorted in reverse order.

All elements are same.

207. In randomized quick sort, initial position of


What is randomized quick sort? pivot is determined randomly.
DATA STRUCTURES FAQ’S

208. Which if the following is/are the levels of implementation of D) All of the above
data structure

A) Abstract level
B) Application level
C) Implementation level
D) All of the above

209. A binary search tree whose left subtree and right subtree A) AVL tree
differ in hight by at most 1 unit is called ……

A) AVL tree
B) Red-black tree
C) Lemma tree
D) None of the above

210. 3. ……………….. level is where the model becomes C) Implementation level


compatible executable code

A) Abstract level
B) Application level
C) Implementation level
D) All of the above

211. Stack is also called as A) Last in first out

A) Last in first out


B) First in last out
C) Last in last out
D) First in first out

212. Which of the following is true about the characteristics of C) True, True
abstract data types?
DATA STRUCTURES FAQ’S

i) It exports a type.

ii) It exports a set of operations

A) True, False
B) False, True
C) True, True
D) False, False

213. …………… is not the component of data structure. D) None of above

A) Operations

B) Storage Structures

C) Algorithms

D) None of above

214. Which of the following is not the part of ADT description? D) None of the above

A) Data

B) Operations

C) Both of the above

D) None of the above

215. Inserting an item into the stack when stack is not full is called A) push, pop
…………. Operation and deletion of item form the stack,
when stack is not empty is called ………..operation.

A) push, pop

B) pop, push
DATA STRUCTURES FAQ’S

C) insert, delete

D) delete, insert

216. ……………. Is a pile in which items are added at one end B) Queue
and removed from the other.

A) Stack

B) Queue

C) List

D) None of the above

217. . ………… is very useful in situation when data have to A) Stack


stored and then retrieved in reverse order.

A) Stack

B) Queue

C) List

D) Link list

218. Which data structure allows deleting data elements from and B) Queues
inserting at rear?

A) Stacks

B) Queues

C) Dequeues

D) Binary search tree


DATA STRUCTURES FAQ’S

219. Which of the following data structure can’t store the non- A) Arrays
homogeneous data elements?

A) Arrays

B) Records

C) Pointers

D) Stacks

220. . A ……. is a data structure that organizes data similar to a A) Queue linked list
line in the supermarket, where the first one in line is the first
one out.

A) Queue linked list

B) Stacks linked list

C) Both of them

D) Neither of them

221. Which of the following is non-liner data structure? D) Trees

A) Stacks

B) List

C) Strings

D) Trees

222. Herder node is used as sentinel in ….. C) Binary tree


DATA STRUCTURES FAQ’S

A) Graphs

B) Stacks

C) Binary tree

D) Queues

223. Which data structure is used in breadth first search of a graph B) queue
to hold nodes?

A) Stack

B) queue

C) Tree

D) Array

224. Identify the data structure which allows deletions at both A) Input restricted dequeue
ends of the list but insertion at only one end.

A) Input restricted dequeue

B) Output restricted qequeue

C) Priority queues

D) Stack

225. Which of the following data structure is non linear type? D) Graph

A) Strings

B) Lists
DATA STRUCTURES FAQ’S

C) Stacks

D) Graph

226. Which of the following data structure is linear type? D) Stack

A) Graph

B) Trees

C) Binary tree

D) Stack

227. To represent hierarchical relationship between elements, C) Tree


Which data structure is suitable?

A) Dequeue

B) Priority

C) Tree

D) Graph

228. A directed graph is ………………. if there is a path from B) Strongly Connected


each vertex to every other vertex in the digraph.

A) Weakly connected

B) Strongly Connected

C) Tightly Connected

D) Linearly Connected
DATA STRUCTURES FAQ’S

229. In the …………….. traversal we process all of a vertex’s A) Depth First


descendants before we move to an adjacent vertex.

A) Depth First

B) Breadth First

C) With First

D) Depth Limited

230. State True of False. B) True, True, False

i) Network is a graph that has weights or costs associated


with it.

ii) An undirected graph which contains no cycles is called a


forest.

iii) A graph is said to be complete if there is no edge between


every pair of vertices.

A) True, False, True

B) True, True, False

C) True, True, True

D) False, True, True

231. 24. Match the following. C) a-iii, b-i, c-ii

a) Completeness i) How long does


it take to find a solution
b) Time Complexity ii) How much
memory need to perform the search.
c) Space Complexity iii) Is the strategy
guaranteed to find the solution when there in one.
DATA STRUCTURES FAQ’S

A) a-iii, b-ii, c-i

B) a-i, b-ii, c-iii

C) a-iii, b-i, c-ii

D) a-i, b-iii, c-ii

232. The number of comparisons done by sequential search is B) (N+1)/2


………………

A) (N/2)+1

B) (N+1)/2

C) (N-1)/2

D) (N+2)/2

233. . In ……………, search start at the beginning of the list and A) Linear search
check every element in the list.

A) Linear search

B) Binary search

C) Hash Search

D) Binary Tree search

234. State True or False. D) True, True

i) Binary search is used for searching in a sorted array.

ii) The time complexity of binary search is O(logn).

A) True, False
DATA STRUCTURES FAQ’S

B) False, True

C) False, False

D) True, True

235. Which of the following is not the internal sort? C) Merge Sort

A) Insertion Sort

B) Bubble Sort

C) Merge Sort

D) Heap Sort

236. State True or False. A) True, True

i) An undirected graph which contains no cycles is called


forest.

ii) A graph is said to be complete if there is an edge between


every pair of vertices.

A) True, True

B) False, True

C) False, False

D) True, False

237. A graph is said to be ……………… if the vertices can be B) Bipartite


split into two sets V1 and V2 such there are no edges
between two vertices of V1 or two vertices of V2.
DATA STRUCTURES FAQ’S

A) Partite

B) Bipartite

C) Rooted

D) Bisects

238. In a queue, the initial values of front pointer f rare pointer r B) 0 and -1
should be …….. and ……….. respectively.

A) 0 and 1

B) 0 and -1

C) -1 and 0

D) 1 and 0

239. In a circular queue the value of r will be .. C) r=(r+1)% QUEUE_SIZE

A) r=r+1

B) r=(r+1)% [QUEUE_SIZE – 1]

C) r=(r+1)% QUEUE_SIZE

D) r=(r-1)% QUEUE_SIZE

240. Which of the following statement is true? C) Both i and ii

i) Using singly linked lists and circular list, it is not possible


to traverse the list backwards.

ii) To find the predecessor, it is required to traverse the list


from the first node in case of singly linked list.
DATA STRUCTURES FAQ’S

A) i-only

B) ii-only

C) Both i and ii

D) None of both

241. The advantage of …………….. is that they solve the problem B) Linked Lists
if sequential storage representation. But disadvantage in that
is they are sequential lists.

A) Lists

B) Linked Lists

C) Trees

D) Queues

242. What will be the value of top, if there is a size of stack C) 4


STACK_SIZE is 5

A) 5

B) 6

C) 4

D) None

243. ………… is not the operation that can be performed on D) Traversal


queue.

A) Insertion

B) Deletion
DATA STRUCTURES FAQ’S

C) Retrieval

D) Traversal

244. There is an extra element at the head of the list called a B) Sentinel
……….

A) Antinel

B) Sentinel

C) List header

D) List head

245. A graph is a collection of nodes, called ………. And line A) vertices, edges
segments called arcs or ……….. that connect pair of nodes.

A) vertices, edges

B) edges, vertices

C) vertices, paths

D) graph node, edges

246. . A ……….. is a graph that has weights of costs associated C) Both A and B
with its edges.

A) Network

B) Weighted graph

C) Both A and B

D) None A and B
DATA STRUCTURES FAQ’S

247. In general, the binary search method needs no more than D) [log2n]+1
……………. comparisons.

A) [log2n]-1

B) [logn]+1

C) [log2n]

D) [log2n]+1

248. Which of the following is not the type of queue? B) Single ended queue

A) Ordinary queue

B) Single ended queue

C) Circular queue

D) Priority queue

249. The property of binary tree is D) The right subtree can be empty

A) The first subset is called left subtree

B) The second subtree is called right subtree

C) The root cannot contain NULL

D) The right subtree can be empty

250. State true or false. C) False, True

i) The degree of root node is always zero.

ii) Nodes that are not root and not leaf are called as internal
DATA STRUCTURES FAQ’S

nodes.

A) True, True

B) True, False

C) False, True

D) False, False

251. Any node is the path from the root to the node is called B) Ancestor node

A) Successor node

B) Ancestor node

C) Internal node

D) None of the above

252. State true of false. B) True, False

i) A node is a parent if it has successor nodes.

ii) A node is child node if out degree is one.

A) True, True

B) True, False

C) False, True

D) False, False

253. ………………. is not an operation performed on linear list D) None of the above
DATA STRUCTURES FAQ’S

a) Insertion b) Deletion c) Retrieval d) Traversal

A) only a,b and c

B) only a and b

C) All of the above

D) None of the above

254. Which is/are the application(s) of stack D) All of the above

A) Function calls

B) Large number Arithmetic

C) Evaluation of arithmetic expressions

D) All of the above

255. A …………… is an acyclic digraph, which has only one A) Directed tree
node with indegree 0, and other nodes have in-degree 1.

A) Directed tree

B) Undirected tree

C) Dis-joint tree

D) Direction oriented tree

256. …………………. Is a directed tree in which outdegree of B) Binary tree


each node is less than or equal to two.

A) Unary tree
DATA STRUCTURES FAQ’S

B) Binary tree

C) Trinary tree

D) Both B and C

257. State true or false. C) True, True

i) An empty tree is also a binary tree.

ii) In strictly binary tree, the out-degree of every node is


either o or 2.

A) True, False

B) False, True

C) True, True

D) False, False

258. Which of the following data structures are indexed A. Linear arrays
structures?

A. Linear arrays

B. Linked lists

C. Queue

D. Stack

259. Which of the following data structure store the homogeneous B. Records
data elements?

A. Arrays
DATA STRUCTURES FAQ’S

B. Records

C. Pointers

D. Lists

260. When new data are to be inserted into a data structure, but B. overflow
there is not available space; this situation is usually called ….

A. Underflow

B. overflow

C. houseful

D. saturated

261. A data structure where elements can be added or removed at D. dequeue


either end but not in the middle is called …

A. linked lists

B. stacks

C. queues

D. dequeue

262. Operations on a data structure may be ….. D. all of the above

A. creation

B. destruction

C. selection
DATA STRUCTURES FAQ’S

D. all of the above

263. The way in which the data item or items are logically related B. data structure
defines …..

A. storage structure

B. data structure

C. data relationship

D. data operation

264. Which of the following are the operations applicable an D. all of the above
primitive data structures?

A. create

B. destroy

C. update

D. all of the above


265. The use of pointers to refer elements of a data structure in B. linked allocation
which elements are logically adjacent is ….

A. pointers

B. linked allocation

C. stack

D. queue
266. Arrays are best data structures A. for relatively permanent collections of
data
A. for relatively permanent collections of data

B. for the size of the structure and the data in the structure are
DATA STRUCTURES FAQ’S

constantly changing

C. for both of above situation

D. for non of above situation

267. Which of the following statement is false? C. Pointers store the next data element of a
list.
A. Arrays are dense lists and static data structure.

B. Data elements in linked list need not be stored in adjacent


space in memory

C. Pointers store the next data element of a list.

D. Linked lists are collection of the nodes that contain


information part and next pointer

268. Which of the following data structure is non-linear type? D) Tree

A) Strings

B) Lists

C) Stacks

D) Tree
269. Which of the following data structure is linear type? A) Array

A) Array

B) Tree

C) Graphs

D) Hierarchy
270. The logical or mathematical model of a particular A) Data structure
organization of data is called a ………

A) Data structure

B) Data arrangement
DATA STRUCTURES FAQ’S

C) Data configuration

D) Data formation
271. The simplest type of data structure is ……………… B) Linear array

A) Multidimensional array

B) Linear array

C) Two dimensional array

D) Three dimensional array

272. Linear arrays are also called ………………. B) One-dimensional array

A) Straight line array

B) One-dimensional array

C) Vertical array

D) Horizontal array
273. Arrays are best data structures ………… A) For relatively permanent collections of
data.
A) For relatively permanent collections of data.

B) For the size of the structure and the data in the structure
are constantly changing

C) For both of above situation

D) For none of the above


274. Which of the following data structures are indexed A) Linear arrays
structures?

A) Linear arrays

B) Linked lists

C) Graphs
DATA STRUCTURES FAQ’S

D) Trees

275. Each node in a linked list has two pairs of ………….. and A) Link field and information field
……………….

A) Link field and information field

B) Link field and avail field

C) Avail field and information field

D) Address field and link field


276. . A …………………… does not keep track of address of C) Linear array
every element in the list.

A) Stack

B) String

C) Linear array

D) Queue
277. When does top value of the stack changes? D) After deletion

A) Before deletion

B) While checking underflow

C) At the time of deletion

D) After deletion
278. . Which of the following data structure is linear type? A) Array

A) Array

B) Tree

C) Graphs

D) Hierarchy
DATA STRUCTURES FAQ’S

279. The logical or mathematical model of a particular A) Data structure


organization of data is called a ………

A) Data structure

B) Data arrangement

C) Data configuration

D) Data formation
280. The simplest type of data structure is ……………… B) Linear array

A) Multidimensional array

B) Linear array

C) Two dimensional array

D) Three dimensional array


281. Linear arrays are also called ………………. B) One-dimensional array

A) Straight line array

B) One-dimensional array

C) Vertical array

D) Horizontal array
282. Arrays are best data structures ………… A) For relatively permanent collections of
data.
A) For relatively permanent collections of data.

B) For the size of the structure and the data in the structure
are constantly changing

C) For both of above situation

D) For none of the above


283. Which of the following data structures are indexed A) Linear arrays
structures?
DATA STRUCTURES FAQ’S

A) Linear arrays

B) Linked lists

C) Graphs

D) Trees
284. Each node in a linked list has two pairs of ………….. and A) Link field and information field
……………….

A) Link field and information field

B) Link field and avail field

C) Avail field and information field

D) Address field and link field


285. A …………………… does not keep track of address of C) Linear array
every element in the list.

A) Stack

B) String

C) Linear array

D) Queue
286. When does top value of the stack changes? D) After deletion

A) Before deletion

B) While checking underflow

C) At the time of deletion

D) After deletion
287. Which of the following data structure is non-linear type? D) Tree

A) Strings

B) Lists

C) Stacks
DATA STRUCTURES FAQ’S

D) Tree
288. Which of the following data structure is linear type? A) Array

A) Array

B) Tree

C) Graphs

D) Hierarchy
289. The logical or mathematical model of a particular A) Data structure
organization of data is called a ………

A) Data structure

B) Data arrangement

C) Data configuration

D) Data formation
290. The simplest type of data structure is ……………… B) Linear array

A) Multidimensional array

B) Linear array

C) Two dimensional array

D) Three dimensional array


291. Linear arrays are also called ………………. B) One-dimensional array

A) Straight line array

B) One-dimensional array

C) Vertical array

D) Horizontal array
292. Arrays are best data structures ………… A) For relatively permanent collections of
data.
A) For relatively permanent collections of data.

B) For the size of the structure and the data in the structure
DATA STRUCTURES FAQ’S

are constantly changing

C) For both of above situation

D) For none of the above


293. Which of the following data structures are indexed A) Linear arrays
structures?

A) Linear arrays

B) Linked lists

C) Graphs

D) Trees
294. Each node in a linked list has two pairs of ………….. and A) Link field and information field
……………….

A) Link field and information field

B) Link field and avail field

C) Avail field and information field

D) Address field and link field


295. A …………………… does not keep track of address of C) Linear array
every element in the list.

A) Stack

B) String

C) Linear array

D) Queue
296. When does top value of the stack changes? D) After deletion

A) Before deletion

B) While checking underflow

C) At the time of deletion

D) After deletion
DATA STRUCTURES FAQ’S

297. Arrays are best data structures A) for relatively permanent collections of
data
A) for relatively permanent collections of data

B) for the size of the structure and the data in the structure
are constantly changing

C) for both of above situation

D) for none of above situation

298. Which of the following data structure is not linear data D) None of the above
structure?

A) Arrays

B) Linked lists

C) Both of the above

D) None of the above


299. The disadvantage in using a circular linked list is A) It is possible to get into infinite loop.
…………………….

A) It is possible to get into infinite loop.

B) Last node points to first node.

C) Time consuming

D) Requires more memory space


300. In a priority queue, insertion and deletion takes place at D) any position
………………

A) front, rear end

B) only at rear end

C) only at front end

D) any position
DATA STRUCTURES FAQ’S

301. The time complexity of quick sort is ………….. C) O(n log n)

A) O(n)

B) O(n2)

C) O(n log n)

D) O(log n)
302. Which of the following is an application of stack? D) all of the above

A) finding factorial

B) tower of Hanoi

C) infix to postfix conversion

D) all of the above


303. The data structure which is one ended is ……………… B) stack

A) queue

B) stack

C) tree

D) graph
304. A list which displays the relationship of adjacency between A) linear
elements is said to be

A) linear

B) non linear

C) linked list

D) trees
305. A graph in which all vertices have equal degree is (A) Complete graph
known as ____
(A) Complete graph
(B) Regular graph
(C) Multi graph
DATA STRUCTURES FAQ’S

(D) Simple graph

306. A vertex of in-degree zero in a directed graph is (C) Sink


called a/an
(A) Root vertex
(B) Isolated vertex
(C) Sink
(D) Articulation point
307. A graph is a tree if and only if graph is (B) Contains no cycles
(A) Directed graph
(B) Contains no cycles
(C) Planar
(D) Completely connected
308. Which of the following piece of information does the (D) All of above
data type to the compiler provide?
(A) The way the data is to be interpreted
(B) Range of values
(C) Amount of memory a data element uses
(D) All of above
309. The elements of a linked list are stored (C) Anywhere the computer has space for
them
(A) In a structure
(B) In an array
(C) Anywhere the computer has space for them
(D) In contiguous memory locations

310. A parentheses checker program would be best (C) Stack


implemented using
(A) List
(B) Queue
(C) Stack
DATA STRUCTURES FAQ’S

(D) Any of the above


311. To perform level-order traversal on a binary tree, (B) Queue
which of the following data structure will be
required?
(A) Hash table
(B) Queue
(C) Binary search tree
(D) Stack
312. Which of the following data structure is required to (D) None of above
convert arithmetic expression in infix to its
equivalent postfix notation?
(A) Queue
(B) Linked list
(C) Binary search tree
(D) None of above
313. A binary tree in which all its levels except the last, have (B) Complete binary tree
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.
(A) Threaded tree
(B) Complete binary tree
(C) M-way search tree
(D) Full binary tree

314. Which of following data structure is more (C) Stack


appropriate for implementing quick sort iteratively?
(A) Deque
(B) Queue
(C) Stack
(D) Priority queue
315. The number of edges in a complete graph of n (B) n(n-1)/2
vertices is
DATA STRUCTURES FAQ’S

(A) n(n+1)/2
(B) n(n-1)/2
(C) n 2 /2
(D) n
316. If two trees have same structure and but different (D) Similar trees
node content, then they are called ___
(A) Synonyms trees
(B) Joint trees
(C) Equivalent trees
(D) Similar trees
317. Which of the following data structure works on the principle Queue
of First Come First Serve?

318. Finding the location of a given item in a collection of items 1) C. Searching


is called......
A. Discovering
B. Finding
C. Searching
D. Mining
319. Which of the following is an external sorting? 2) C. Merge Sort
A. Insertion Sort
B. Bubble Sort
C. Merge Sort
D. Tree Sort
320. Very slow way of sorting is.......... 3) A. Insertion sort
A. Insertion sort
B. Heap sort
C. Bubble sort
D. Quick sort
321. The time complexity of quick sort is........ 6) D. O(n logn)
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
DATA STRUCTURES FAQ’S

322. Selection sort first finds them .......... element in the list and 7) D. Smallest element
put it in the first position.
A. Middle element
B. Largest element
C. Last element
D. Smallest element
323. Quick sort is also known as........ 8) D. partition and exchange sort
A. merge sort
B. tree sort
C. shell sort
D. partition and exchange sort
324. The operation that combines the element is of A and B in 9) C. Merging
a single sorted list C with n=r+s element is called....
A. Inserting
B. Mixing
C. Merging
D. Sharing
325. sorting is good to use when alphabetizing large list of C. Radix
names.
A. Merge
B. Heap
C. Radix
D. Bubble
326. The easiest sorting is........ 12) D. selection sort
A. quick sort
B. shell sort
C. heap sort
D. selection sort
327. Which of the following sorting algorithm is of divide and 13) C. Quick sort
conquer type?
A. Bubble sort
B. Insertion sort
C. Quick sort
D. Merge sort
328. If the number of record to be sorted large and the key is 18) C. Quick
long, then ............................................................................................... sorting can be efficient.
A. Merge
B. Heap
C. Quick
D. Bubble
DATA STRUCTURES FAQ’S

329. The time complexity of heap sort is .... 19) D. O(n logn)
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
330. The complexity of selection sort is ....... B. O(n2)
A. O(n)
B. O(n2)
C. O(n logn)
D. O(logn)
331. The worst case occurs in linear search algorithm when....... 1) D. Item is the last element in the array or
A. Item is somewhere in the middle of the array item is not there at all
B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or item is not there at
all
332. If the number of records to be sorted is small, then 2) C. Selection
sorting can be efficient.
A. Merge
B. Heap
C. Selection
D. Bubble
333. The complexity of sorting algorithm measures the .... as a 3) B. running time
function of the number n of items to be
sorter.
A. average time
B. running time
C. average-case complexity
D. case-complexity
334. Which of the following is not a limitation of binary search D. binary search algorithm is not efficient
algorithm? when the data elements more than 1500.
A. must use a sorted array
B. requirement of sorted array is expensive when a lot of
insertion and deletions are needed
C. there must be a mechanism to access middle element
directly
D. binary search algorithm is not efficient when the data
DATA STRUCTURES FAQ’S

elements more than 1500.


335. 6) D. pointer array
Binary search algorithm cannot be applied to...
A. sorted linked list
B. sorted binary trees
C. sorted linear array
D. pointer array
336. Complexity of linear search algorithm is......... 7) A. O(n)
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
337. Sorting algorithm can be characterized as...... 8) C. Both of the above
A. Simple algorithm which require the order of n2
comparisons to sort n items.
B. Sophisticated algorithms that require the O(nlog2n)
comparisons to sort items.
C. Both of the above
D. None of the above
338. The complexity of bubble sort algorithm is..... C.O(n2)
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
339. The time required to read or write is considered to be 10) B. i-True, ii-False
significant in evaluating the performance of internal
sorting.
A. i-True, ii-True
B. i-True, ii-False
C. i-False, ii-True
D. i-False, ii-False
340. The complexity of merge sort algorithm is...... 11) D. O(n logn)
A. O(n)
B. O(logn)
C. O(n2)
D. O(n logn)
341. order is the best possible for array sorting algorithm which 12) C. O(n+logn)
sorts n item.
A. O(n logn)
B. O(n2)
DATA STRUCTURES FAQ’S

C. O(n+logn)
D. O(logn)
342. is the method used by card sorter? 13) A. Radix sort
A. Radix sort
B. Insertion
C. Heap
D. Quick
343. Sorting algorithm is frequently used when n is small where n 14) B. Insertion
is total number of elements.
A. Heap
B. Insertion
C. Bubble
D. Quick
344. Which of the following is not the required condition for 15) C. There must be mechanism to delete
binary search algorithm? and/or insert elements in list.
A. The list must be sorted
B. There should be the direct access to the middle element in
any sub list
C. There must be mechanism to delete and/or insert elements
in list.
D. Number values should only be present
345. Partition and exchange sort is........ A. quick sort
A. quick sort
B. tree sort
C. heap sort
D. bubble sort
346. ............ form of access is used to add and remove nodes 1) B. FIFO, First In First Out
from a queue.
A. LIFO, Last In First Out
B. FIFO, First In First Out
C. Both a and b
D. None of these
347. Form of access is used to add remove nodes from a stack. 2) A. LIFO
A. LIFO
B. FIFO
C. Both A and B
D. None of these
348. New nodes are added to the ........... of the queue. 3) B. Back
A. Front
B. Back
DATA STRUCTURES FAQ’S

C. Middle
D. Both A and B

349. What happens when you push a new node onto a stack? 4) A. The new node is placed at the front of
A. The new node is placed at the front of the linked list the linked list
B. The new node is placed at the back of the linked list
C. The new node is placed at the middle of the linked list
D. No Changes happens
350. Which of the following name does not relate to stacks? 5) A. FIFO lists
A. FIFO lists
B. LIFO lists
C. Piles
D. Push down lists
351. The term push and pop is related to 6) C. Stacks
A. Array
B. Lists
C. Stacks
D. Trees
352. The elements are removal from a stack in ......... order. 7) A. Reverse
A. Reverse
B. Hierarchical
C. Alternative
D. Sequential
353. is the term used to insert an element into stack? 8) A. Push
A. Push
B. Pull
C. Pop
D. Pump

354. is the term used to delete an element from the stack? C.Pop
A. Push
B. Pull
C. Pop
D. Pump
DATA STRUCTURES FAQ’S

355. A pointer variable which contains the location at the top A. Top
element of the stack is called.....
A. Top
B. Last
C. Final
D. End

356. Before inserting into stack one must check the 1) A. Overflow
condition.........
A. Overflow
B. Underflow
C. Maximum elements
D. Existing elements

357. 2) B. Underflow
Before deletion condition into stack ...... has to be checked.
A. Overflow
B. Underflow
C. Maximum elements
D. Existing elements

358. When does Top value of stack change in insertion process? 3) A. Before insertion
A. Before insertion
B. After insertion
C. At the time of insertion
D. While checking overflow

359. Deletion in the linked stack takes place by deleting........ 4) A. Node pointed by the start process
A. Node pointed by the start process.
B. End of the list
DATA STRUCTURES FAQ’S

C. Beginning of the list


D. Middle of the list

360. The condition ......... Indicate the queue is empty. 5) A. Front=Null


A. Front=Null
B. Null=Front
C. Front=Rear
D. Rear=Null

361. The value of REAR is increased by 1 when....... 6) C. An element is added in a queue


A. An element is deleted in a queue
B. An element is traversed in a queue
C. An element is added in a queue
D. An element is merged in a queue

362. The term dequeue is the contraction of the name........ 7) A. Double ended queue
A. Double ended queue
B. Double side queue
C. Double headed queue
D. Double address queue

363. is a collection of elements such that each element has been 8) A. Priority queue
assigned a processing priority.
A. Priority queue
B. Procedure queue
C. Main queue
D. Interrupt queue
364. Link fields hold pointers to the .......... element in the linked 9) A. Neighboring
representation of stack.
A. Neighboring
DATA STRUCTURES FAQ’S

B. Last
C. First
D. Middle

365. 10) Reversing a great deal of space for each stack in memory A. Decrease the numbers of times overflow
will........... may occur
A. Decrease the numbers of times overflow may occur
B. Increase the numbers of times overflow may occur
C. Increase the number of times underflow may occur
D. Increase the number of times underflow may occur.
366. The operation of processing each element in the list is 1) D. traversal
known as......
A. sorting
B. merging
C. inserting
D. traversal
367. Binary trees with threads are called as....... 2) A. Threaded trees
A. Threaded trees
B. Pointer trees
C. Special trees
D. Special pointer trees
368. In Binary trees nodes with no successor are called...... 3) B. Terminal nodes
A. End nodes
B. Terminal nodes
C. Final nodes
D. Last nodes
369. Trees are said ............ if they are similar and have same 4) D. Copies
contents at corresponding nodes.
A. Duplicate
B. Carbon copy
C. Replica
D. Copies
370. Every node N in a binary tree T except the root has a unique 5) B. Predecessor
parent called the ...................................................................................................... of N.
A. Antecedents
B. Predecessor
C. Forerunner
D. Precursor
DATA STRUCTURES FAQ’S

371. Sequential representation of binary tree uses........ 6) A. Array with pointers


A. Array with pointers
B. Single linear array
C. Two dimensional arrays
D. Three dimensional arrays

372. TREE[1]=NULL indicates tree is ........ 7) C. Empty


A. Overflow
B. Underflow
C. Empty
D. Full
373. Linked representation of binary tree needs ......... parallel C. 3
arrays.
A. 4
B. 2
C. 3
D. 5
374. In a 2-tree, nodes with 0 children are called............ 9) D. External node
A. Exterior node
B. Outside node
C. Outer node
D. External node
375. In a extended-binary tree nodes with 2 children are C. Internal node
called........
A. Interior node
B. Domestic node
C. Internal node
D. Inner node
376. While converting binary tree into extended binary tree, all 1) A. Internal nodes on extended tree
the original nodes in binary tree are.......
A. Internal nodes on extended tree
B. External nodes on extended tree
C. Vanished on extended tree
D. Intermediate nodes on extended tree
377. In a binary tree, certain null entries are replaced by 2) D. Thread
special pointers which point to nodes higher in the tree
for efficiency. These special pointers are called.........
A. Leaf
DATA STRUCTURES FAQ’S

B. Branch
C. Path
D. Thread
378. The in order traversal of tree will yield a sorted listing of 3) B. Binary search trees
elements of tree in....
A. Binary trees
B. Binary search trees
C. Merging
D. AVL Trees
379. A binary tree whose every node has either zero or two 4) C. Extended binary tree
children is called.........
A. Complete binary tree
B. Binary Search tree
C. Extended binary tree
D. E2 tree
380. In order traversing a tree resulted E A C K F H D B G; the 6) B. FAEKCDHGB
preorder traversal would return.
A. FAEKCDBHG
B. FAEKCDHGB
C. EAFKHDCBG

D. FEAKDCHBG
381. In linked representation of Binary trees LEFT[k] contains 7) A. Data
the ................................................................................................ of at the node N, where k is the
location.
A. Data
B. Location and left child
C. Right child address
D. Null value
382. Three standards ways of traversing a binary tree T with root 8) D. Pre-order, in-order, post-order
R .......
A. Prefix, infix, postfix
B. Pre-process, in-process, post-process
C. Pre-traversal, in-traversal, post-traversal
D. Pre-order, in-order, post-order
383. Which indicates pre-order traversal? 9) C. Root, Left sub-tree, Right sub-tree
A. Left sub-tree, Right sub-tree and root
B. Right sub-tree, Left sub-tree and root
C. Root, Left sub-tree, Right sub-tree
D. Right sub-tree, root, Left sub-tree
DATA STRUCTURES FAQ’S

384. Which indicates in-order traversal? 1) D. Right sub-tree, root, Left sub-tree
A. Left sub-tree, Right sub-tree and root
B. Right sub-tree, Left sub-tree and root
C. Root, Left sub-tree, Right sub-tree
D. Right sub-tree, root, Left sub-tree
385. The line drawn from a node N of tree T to a successor is 2) B. Edge
called .......
A. Path
B. Edge
C. Arrow
D. Route
386. In a binary tree a sequence of consecutive edges is called 3) D. Path
......
A. Rotate
B. Connecting lines
C. Two-way
D. Path
387. Which of the following indicates post-order traversal? 4) A. Left sub-tree, Right sub-tree and root
A. Left sub-tree, Right sub-tree and root
B. Right sub-tree, Left sub-tree and root
C. Root, Left sub-tree, Right sub-tree
D. Right sub-tree, root, Left sub-tree
388. The root R of the binary tree is assigned a level number of B. 0
......
A. 1
B. 0
C. -1
D. Null
389. 6) C. Both left & right sub trees are empty
If node N is a terminal node in a binary tree then its .........
A. Right tree is empty
B. Left tree is empty
C. Both left & right sub trees are empty
D. Root node is empty
390. The line drawn from a node N of tree T to a successor is 3) B. Edge
called .......
E. Path
F. Edge
G. Arrow
H. Route
DATA STRUCTURES FAQ’S

391. In a binary tree a sequence of consecutive edges is called 4) D. Path


......
E. Rotate
F. Connecting lines
G. Two-way
H. Path
392. Which of the following indicates post-order traversal? 5) A. Left sub-tree, Right sub-tree and root
E. Left sub-tree, Right sub-tree and root
F. Right sub-tree, Left sub-tree and root
G. Root, Left sub-tree, Right sub-tree
H. Right sub-tree, root, Left sub-tree
393. The root R of the binary tree is assigned a level number of B. 0
......
E. 1
F. 0
G. -1
H. Null
394. If node N is a terminal node in a binary tree then its ......... 7) C. Both left & right sub trees are empty
E. Right tree is empty
F. Left tree is empty
G. Both left & right sub trees are empty
H. Root node is empty
395. In threaded binary tree ........... points to higher nodes in tree.
A. Info 7) C. Threads
B. Root
C. Threads
D. Child
396. A graph is said to be ........... if there is a path between any 8) A. Connected
two of its nodes
A. Connected
B. Coupled
C. Attached
D. Allied
397. A graph is said to be ........ if every node u in G is adjacent to 9) D. Complete
every other node v in G.
A. Absolute
B. Entire
C. Inclusive
D. Complete
398. A graph is said to be .......... if its edges are assigned data. 10) C. Lebeled
DATA STRUCTURES FAQ’S

A. Tagged
B. Marked
C. Lebeled
D. Sticked
399. Other name for directed graph is .......... D. Digraph
A. Direct graph
B. Digraph
C. Dir-graph
D. Digraph
400. Graph G is ..................if for any pair u, v of nodes in G there C. Unliterally connected
is a path from u to v or path from v to u.
A. Leterally connected
B. Widely Connected
C. Unliterally connected
D. Literally connected
401. A connected graph T without any cycles is called ........ 13) A. free graph
A. free graph
B. no cycle graph
C. non cycle graph
D. circular graph

402. A connected graph T without any cycles is called a ........ 14) D. All of the above
A. A tree graph
B. Free tree
C. A tree d
D. All of the above

403. In a graph if E=(u,v) means ...... 15) D. both b and c


A. u is adjacent to v but v is not adjacent to u
B. e begins at u and ends at v
C. u is processor and v is successor
D. both b and c
DATA STRUCTURES FAQ’S

404. In a graph if e=[u,v], Then u and v are called ........ 16) D. All of the above
A. End points of e
B. Adjacent nodes
C. Neighbours
D. All of the above

405. D. traversal
The operation of processing each element in the list is known as
……
A. sorting
B. merging
C. inserting
D. traversal

406. D. Digraph
Another name for the directed graph is ……….
A. Direct graph
B. Digraph
C. Dir-graph
D. Digraph

407. A. Threaded trees


Binary trees with threads are called as …….
A. Threaded trees
B. Pointer trees
C. Special trees
D. Special pointer trees

408. C. Unliterally connected


Graph G is ………….. if for any pair u, v of nodes in G there is a
path from u to v or path from v to u.
A. Literally connected
B. Widely Connected
C. Unliterally connected
D. Literally connected

409. B. Terminal nodes


In Binary trees, nodes with no successor are called ……
A. End nodes
B. Terminal nodes
DATA STRUCTURES FAQ’S

C. Final nodes
D. Last nodes

410. A. free graph


A connected graph T without any cycles is called ……..
A. free graph
B. no cycle graph
C. non-cycle graph
D. circular graph

411. D. Copies
Trees are said ………. if they are similar and have the same
contents at corresponding nodes.
A. Duplicate
B. Carbon copy
C. Replica
D. Copies

412. A connected graph T without any cycles is called a …….. D. All of the above
A. A tree graph
B. Free tree
C. A tree d
D. All of the above

413. Every node N in a binary tree T except the root has a unique B. Predecessor
parent called the ……… of N.
A. Antecedents
B. Predecessor
C. Forerunner
D. Precursor

414. In a graph if E=(u,v) means …… D. both b and c


A. u is adjacent to v but v is not adjacent to u
B. e begins at u and ends at v
C. u is processor and v is the successor
D. both b and c

415. Sequential representation of binary tree uses …….. A. Array with pointers
A. Array with pointers
B. Single linear array
C. Two-dimensional arrays
D. Three-dimensional arrays
DATA STRUCTURES FAQ’S

416. In a graph, if e=[u,v], Then u and v are called …….. D. All of the above
A. Endpoints of e
B. Adjacent nodes
C. Neighbors
D. All of the above

417. TREE[1]=NULL indicates the tree is …….. C. Empty


A. Overflow
B. Underflow
C. Empty
D. Full

418. A binary tree whose every node has either zero or two children is C. extended binary tree
called …….
A. complete binary tree
B. binary search tree
C. extended binary tree
D. data structure

419. Linked representation of binary tree needs ……… parallel C. 3


arrays.
A. 4
B. 2
C. 3
D. 5

420. D. Dn = log2n+1
The depth of the complete binary tree is given by ……
A. Dn = n log2n
B. Dn= n log2n+1
C. Dn = log2n
D. Dn = log2n+1

421. D. External node


In a 2-tree, nodes with 0 children are called …………
A. Exterior node
B. Outside node
C. Outer node
D. External node

422. C. Root, Left sub-tree, Right sub-tree


Which indicates pre-order traversal?
A. Left sub-tree, Right sub-tree and root
DATA STRUCTURES FAQ’S

B. Right sub-tree, Left sub-tree and root


C. Root, Left sub-tree, Right sub-tree
D. Right sub-tree, root, Left sub-tree

423. C. Internal node


In extended-binary tree nodes with 2 children are called ……..
A. Interior node
B. Domestic node
C. Internal node
D. Inner node

424. B. Leaf
A terminal node in a binary tree is called …………
A. Root
B. Leaf
C. Child
D. Branch

425. B. FIFO, First In First Out


1) ......... form of access is used to add and remove nodes
from a queue.

A. LIFO, Last In First Out

B. FIFO, First In First Out

C. Both a and b

D. None of these

426. A. INFO fields


In liked representation of stack ....... holds the elements of the
stack.

A. INFO fields

B. TOP fields

C. LINK fields

D. NULL fields
DATA STRUCTURES FAQ’S

427. A. LIFO
........ form of access is used to add remove nodes from a
stack.

A. LIFO

B. FIFO

C. Both A and B

D. None of these

428. C. Start pointer


In the linked representation of the stack ......... behaves as the
top pointer variable of stack.
A. Stop pointer

B. Begin pointer

C. Start pointer

D. Avail pointer

429. B. Back
New nodes are added to the ......... of the queue.

A. Front

B. Back

C. Middle

D. Both A and B

430. B. Bottom of the stack


In linked representation of stack the null pointer of the last
node in the list signals ..........
A. Beginning of the stack

B. Bottom of the stack

C. Middle of the stack


DATA STRUCTURES FAQ’S

D. In between some value

431. A. The new node is placed at the front of the


What happens when you push a new node onto a stack? linked list

A. The new node is placed at the front of the linked list

B. The new node is placed at the back of the linked list

C. The new node is placed at the middle of the linked list

D. No Changes happens

432. A. FIFO
A queue is a .........

A. FIFO

B. LIFO

C. FILO

D. LOFI

433. A. FIFO lists


Which of the following name does not relate to stacks?
A. FIFO lists

B. LIFO lists

C. Piles

D. Push down lists

434. B. pop
The retrieval of items in a stack is ........... operation.
A. push

B. pop

C. retrieval
DATA STRUCTURES FAQ’S

D. access

435. C. Stacks
The term push and pop is related to

A. Array

B. Lists

C. Stacks

D. Trees

436. C. TOP
Which is the pointer associated with the stack?
A. FIRST

B. FRONT

C. TOP

D. REAR

437. A. Reverse
The elements are removal from a stack in .......... order.
A. Reverse

B. Hierarchical

C. Alternative

D. Sequential

438. B. push
The insertion operation in the stack is called .........
A. insert

B. push

C. pop

D. top
DATA STRUCTURES FAQ’S

439. A. Push
...... is the term used to insert an element into stack.
A. Push

B. Pull

C. Pop

D. Pump

440. A. LIFO
Stack follows the strategy of ........
A. LIFO

B. FIFO

C. LRU

D. RANDOM

441. C. Pop
.......... is the term used to delete an element from the stack.

A. Push

B. Pull

C. Pop

D. Pump

442. o, duplicate keys cannot be inserted in


Can we store a duplicate key in HashMap?
HashMap. If you try to insert any entry with
an existing key, then the old value would be
overridden with the new value. Doing this
will not change the size of HashMap.
• This is why the keySet() method returns all
keys as a SET in Java since it doesn't allow
duplicates.

443. List out few of the applications that make use of Multilinked1. Sparse matrix,
Structures? 2. Index generation
DATA STRUCTURES FAQ’S

444. Deletion operation is done using ......... in a queue. 3. A. front

A. front

B. rear

C. top

D. list
445. A pointer variable which contains the location at the top element of 4. A. Top
the stack is called .....

A. Top

B. Last

C. Final

D. End
446. Which of the following is an application of stack? 5. D. all of the above

A. finding factorial

B. tower of Hanoi

C. infix to postfix

D. all of the above


447. A. 6. D) None of above
…………… is not the component of data structure.
A) Operations
B) Storage Structures
C) Algorithms
D) None of above
448. Inserting an item into the stack when stack is not full is 7. A) push, pop
called …………. Operation and deletion of item form the
stack, when stack is not empty is called ………..operation.
A) push, pop
B) pop, push
C) insert, delete
D) delete, insert
449. ……………. Is a pile in which items are added at one end8. B) Queue
and removed from the other.
A) Stack
B) Queue
DATA STRUCTURES FAQ’S

C) List
D) None of the above
450. ………… is very useful in situation when data have to 9. A) Stack
stored and then retrieved in reverse order.
A) Stack
B) Queue
C) List
D) Link list
451. Which of the following data structure can’t store the non- 10. A) Arrays
homogeneous data elements?
A) Arrays
B) Records
C) Pointers
D) Stacks
452. A ……. is a data structure that organizes data similar to a11. A) Queue linked list
line in the supermarket, where the first one in line is the
first one out.
A) Queue linked list
B) Stacks linked list
C) Both of them
D) Neither of them
453. Which of the following is non-liner data structure? 12. D) Trees
A) Stacks
B) List
C) Strings
D) Trees
454. Herder node is used as sentinel in ….. 13. C) Binary tree
A) Graphs
B) Stacks
C) Binary tree
D) Queues
455. Which of the following data structure is non linear type? 14. D) Graph
A) Strings
B) Lists
C) Stacks
D) Graph
456. A directed graph is ………………. if there is a path from 15. B) Strongly Connected
each vertex to every other vertex in the digraph.
A) Weakly connected
B) Strongly Connected
C) Tightly Connected
D) Linearly Connected
457. In the …………….. traversal we process all of a vertex’s 16. A) Depth First
descendants before we move to an adjacent vertex.
A) Depth First
B) Breadth First
DATA STRUCTURES FAQ’S

C) With First
D) Depth Limited
458. State True of False. 17. B) True, True, False
i) Network is a graph that has weights or costs associated
with it.
ii) An undirected graph which contains no cycles is called
a forest.
iii) A graph is said to be complete if there is no edge
between every pair of vertices.
A) True, False, True
B) True, True, False
C) True, True, True
D) False, True, True
459. Match the following. 18. C) a-iii, b-i, c-ii
a) Completeness i) How long does it take to find a solution
b) Time Complexity ii) How much memory need to
perform the search.
c) Space Complexity iii) Is the strategy guaranteed to find
the solution when there in one.
A) a-iii, b-ii, c-i
B) a-i, b-ii, c-iii
C) a-iii, b-i, c-ii
D) a-i, b-iii, c-ii
460. The number of comparisons done by sequential search is19. B) (N+1)/2
………………
A) (N/2)+1
B) (N+1)/2
C) (N-1)/2
D) (N+2)/2
461. A graph is said to be ……………… if the vertices can be 20. B) Bipartite
split into two sets V1 and V2 such there are no edges
between two vertices of V1 or two vertices of V2.
A) Partite
B) Bipartite
C) Rooted
D) Bisects
462. In a circular queue the value of r will be .. 21. C) r=(r+1)% QUEUE_SIZE
A) r=r+1
B) r=(r+1)% [QUEUE_SIZE – 1]
C) r=(r+1)% QUEUE_SIZE
D) r=(r-1)% QUEUE_SIZE
463. ………… is not the operation that can be performed on 22. D) Traversal
queue.
A) Insertion
B) Deletion
C) Retrieval
DATA STRUCTURES FAQ’S

D) Traversal
464. here is an extra element at the head of the list called a 23. B) Sentinel
……….
A) Antinel
B) Sentinel
C) List header
D) List head
465. In general, the binary search method needs no more than24. D) [log2n]+1
……………. comparisons.
A) [log2n]-1
B) [logn]+1
C) [log2n]
D) [log2n]+1
466. Any node is the path from the root to the node is called 25. B) Ancestor node
A) Successor node
B) Ancestor node
C) Internal node
D) None of the above
467. A …………… is an acyclic digraph, which has only one 26. A) Directed tree
node with indegree 0, and other nodes have in-degree 1.
A) Directed tree
B) Undirected tree
C) Dis-joint tree
D) Direction oriented tree
468. Which of the following data structure store the 27. B. Records
homogeneous data elements?
A. Arrays
B. Records
C. Pointers
D. Lists
469. Which of the following statement is false? 28. C. Pointers store the next data element of
A. Arrays are dense lists and static data structure. a list.
B. Data elements in linked list need not be stored in
adjacent space in memory
C. Pointers store the next data element of a list.
D. Linked lists are collection of the nodes that contain
information part and next pointer.
470. Which of the following data structure is linear type? 29. A) Array
A) Array
B) Tree
C) Graphs
D) Hierarchy
471. Arrays are best data structures ………… 30. A) For relatively permanent collections of
A) For relatively permanent collections of data. data.
B) For the size of the structure and the data in the
structure are constantly changing
DATA STRUCTURES FAQ’S

C) For both of above situation


D) For none of the above
472. Each node in a linked list has two pairs of ………….. and 31. A) Link field and information field
……………….
A) Link field and information field
B) Link field and avail field
C) Avail field and information field
D) Address field and link field
473. The logical or mathematical model of a particular 32. A) Data structure
organization of data is called a ………
A) Data structure
B) Data arrangement
C) Data configuration
D) Data formation
474. In liked representation of stack ....... holds the elements of33. A. INFO fields
the stack.

A. INFO fields

B. TOP fields

C. LINK fields

D. NULL fields
475. In the linked representation of the stack ......... behaves as34. C. Start pointer
the top pointer variable of stack.

A. Stop pointer

B. Begin pointer

C. Start pointer

D. Avail pointer
476. New nodes are added to the ......... of the queue. 35. B. Back

A. Front

B. Back

C. Middle

D. Both A and B
477. What happens when you push a new node onto a stack? 36. A. The new node is placed at the front of
the linked list
A. The new node is placed at the front of the linked list
DATA STRUCTURES FAQ’S

B. The new node is placed at the back of the linked list

C. The new node is placed at the middle of the linked list

D. No Changes happens
478. State true or false. 37. C) False, True

i) The degree of root node is always zero.

ii) Nodes that are not root and not leaf are called as
internal nodes.

A) True, True

B) True, False

C) False, True

D) False, False
479. hich of the following data structures are indexed 38. A. Linear arrays
structures?

A. Linear arrays

B. Linked lists

C. Queue

D. Stack

480. Arrays are best data structures 39. A. for relatively permanent collections of
data
A. for relatively permanent collections of data

B. for the size of the structure and the data in the structure
are constantly changing

C. for both of above situation

D. for non of above situation


481. Which of the following statement is false? 40. C. Pointers store the next data element of
a list.
A. Arrays are dense lists and static data structure.
DATA STRUCTURES FAQ’S

B. Data elements in linked list need not be stored in


adjacent space in memory

C. Pointers store the next data element of a list.

D. Linked lists are collection of the nodes that contain


information part and next pointer.
482. Inserting an item into the stack when stack is not full is 41. A) push, pop
called …………. Operation and deletion of item form the
stack, when stack is not empty is called ………..operation.

A) push, pop

B) pop, push

C) insert, delete

D) delete, insert
483. Which is the pointer associated with the availability list? B. AVAIL
42.
A. FIRST

B. AVAIL

C. TOP

D. REAR

484. LLINK is the pointer pointing to the ... B. predecessor node


43.
A. successor node

B. predecessor node

C. head node

D. last node

485. A run list is ...... A. small batches of records from a file

A. small batches of records from a file 44.

B. number of elements having same value

C. number of records
DATA STRUCTURES FAQ’S

D. number of files in external storage

486. Indexing the ........ element in the list is not possible in linked A. middle
lists. 45.

A. middle

B. first

C. last

D. any where in between

487. Sorting a file F usually refers to sorting F with respect to a46. B. Primary key
particular key called .....

A. Basic key

B. Primary key

C. Starting key

D. Index key
488. Quick sort is also known as ........ 47. D. partition and exchange sort

A. merge sort

B. tree sort

C. shell sort

D. partition and exchange sort


489. Merging k sorted tables into a single sorted table is called48. A. k way merging
......

A. k way merging

B. k th merge

C. k+1 merge

D. k-1 merge
O(logn)
490. D. Item is the last element in the array or
1) The worst case occur in linear search algorithm when item is not there at all
.......
DATA STRUCTURES FAQ’S

A. Item is somewhere in the middle of the array 49.


B. Item is not in the array at all
C. Item is the last element in the array
D. Item is the last element in the array or item is not there
at all

491. Which of the following is not a limitation of binary search D. binary search algorithm is not efficient
algorithm? when the data elements more than 1500.
A. must use a sorted array 50.
B. requirement of sorted array is expensive when a lot of
insertion and deletions are needed
C. there must be a mechanism to access middle element
directly
D. binary search algorithm is not efficient when the data
elements more than 1500.

492. Define ancestor and descendant ? If there is a path from node n1 to n2, then
n1 is the ancestor of n2 and n2 is the
descendant of n1.
493. What is the difference between Storage structure and file Storage Structure:-The memory that is
structure? allocated to a variable or a constant is stored
in the main memory of the computer that is
RAM which gets deleted as soon as the
function ends. This representation of
allocating the memory is called Storage
Structure

File Structure:-If you write the data in a file


and save that file in the hard disk or any
other external device like Pen Drive then the
data will remain intact till it is deleted
manually by the user. This representation of
saving the file in an auxiliary or secondary
memory is called File Structure

494. Which one of the below is not divide and conquer approach? B - Merge Sort
A - Insertion Sort
B - Merge Sort
C - Shell Sort
D - Heap Sort
DATA STRUCTURES FAQ’S

495. Postfix expression is just a reverse of prefix expression. B - False


A - True
B - False

496. Which of the following asymptotic notation is the worst B - Ο(n3)


among all?
A - Ο(n+9378)
B - Ο(n3)
C - nΟ(1)
D - 2Ο(n)

497. Graph traversal is different from a tree traversal, because C - trees have root.
A - trees are not connected.
B - graphs may have loops.
C - trees have root.
D - None is true as tree is a subset of graph.

498. Which of these alogrithmic approach tries to achieve A - Greedy approach


localized optimum solution −
A - Greedy approach
B - Divide and conquer approach
C - Dynamic approach
D - All of the above

499. Recursion uses more memory space than iteration because B - every recursive call has to be stored.
A - it uses stack instead of queue.
B - every recursive call has to be stored.
C - both A & B are true.
D - None of the above are true.
DATA STRUCTURES FAQ’S

500. The worst case complexity of binary search matches with − B - linear search
A - interpolation search
B - linear search
C - merge sort
D - none of the above

You might also like