Data Structures and Algorithm Analysis Set 16

Data Structures and Algorithm Analysis

Questions 151 to 160



151.
Suppose cursor refers to a node in a linked list then what statement changes cursor so that it refers to the next node?
(a)
cursor++;
(b)
cursor = link;
(c)
cursor += link;
(d)
cursor = cursor → link;
(e)
cursor = link → cursor;
152.
The method which traverses the array sequentially to locate the given item in an array is called
(a)
Ordered search
(b)
Linear search
(c)
Binary search
(d)
Hash search
(e)
Heap search.
153.
Which of the following data structure does require recursion method?
(a)
Queue
(b)
List
(c)
Tree
(d)
Graph
(e)
Stack.
154.
Select the correct order of steps for post order traversal from the following:
I.     Visit root node.
II.     Traverse the right sub-tree.
III.    Traverse the left sub-tree.
(a)
III, II, I
(b)
I, II, III
(c)
I, III, II
(d)
II, I, III
(e)
II, III, I.
155.
Which of the following data structures is a best example for multitasking systems?
(a)
Stack
(b)
Linked List
(c)
Queue
(d)
Tree
(e)
Graph.
156.
A complete graph with ‘N’ nodes will have
(a)
(N – 1)/2 edges
(b)
N(N – 1) edges
(c)
N(N + 1) edges
(d)
N(N – 1)/2 edges
(e)
N – 1 edges.
157.
In a graph, which of the following algorithms does determine the reachability of all node pairs?
(a)
Floyd’s algorithm
(b)
Warshall’s algorithm
(c)
Kruskal’s algorithm
(d)
Prim’s algorithm
(e)
Multistage graph algorithm.
158.
What is the average time complexity of the heap sort?
(a)
O(n2)
(b)
O(n)
(c)
O(n/2)
(d)
O(log n)
(e)
O(n log n).
159.
What is the value of the following postfix expression?
2, 5, 9, –, /, 2, 2, 5, +, *, +
(a)
13.5
(b)
18.5
(c)
25.5
(d)
15.0
(e)
27.5.
160.
What would be the total number of moves in Tower of Hanoi when n = 7?
(a)
128
(b)
127
(c)
126
(d)
256
(e)
255.


Answers


151.
Answer : (d)
Reason:  Because, in the node link is self referential pointer with which we can reach the next node with the statement cursor = cursor à link, and the remaining operations are not valid.
152.
Answer : (b)
Reason:  Because, in linear search sequentially all the locations are searched to locate an array, that is not with the other given methods.
153.
Answer : (e)
Reason:  Because, stack always holds the return values in the recursive calls and also the intermediate results. The remaining data structures are not suitable for the recursive calls.
154.
Answer : (a)
Reason:  Because, for the post order traversal, first traverse the left sub tree in post order then traverse the right sub tree in post order and then visit the root.
155.
Answer : (c)
Reason:  Because, for multiple jobs they are stored in a queue and are processed by the processor depending upon their priority. The remaining data structures are not suitable for scheduling the jobs in multitasking operating systems.
156.
Answer : (d)
Reason:  Because, every node is connected with the remaining all the nodes, and hence the total number of edges is N(N-1)/2.
157.
Answer : (b)
Reason:  Because, Warshall’s algorithm finds the shortest path between any two given pair of nodes. The remaining algorithms are not used for this purpose.
158.
Answer : (e)
Reason:  According to the mathematical evaluation and priori approach.
159.
Answer : (a)
Reason:  That is, the given infix expression is  2/(5-9)+2*(2+5).
160.
Answer : (b)
Reason:  That is 27-1 ( 2n-1).



No comments :

What you think about these Questions and Answers ? Let me know in comments.

Post a Comment