Data Structure and Algorithm Analysis Set 2

Data Structure and Algorithm Analysis

Questions 11 to 20



11.
If for the above problem, the tree is created following the FIFOBB, then the values for ĉ (5) and u(5) respectively are
(a)  -40, -40              (b)  -40, -38             (c)  -40, -32              (d)  -22, -32             (e)  -32, -22.
12.
There is a chain of 20 stores; each of the store having 5 departments. Then, which of the following is a correct representation of array size?
(a)  5 * 20                (b)  6 * 21                (c)  20 * 5                (d)  21 * 6                (e)  19 * 4.
13.
From the following, select the valid data structure which reflects hierarchical relationship between the elements.
(a)  Graph                (b)  Queue               (c)  Linked list          (d)  Stack                (e)  Tree.
14.
Which of the following matrix does have high proportions of zero entries as the elements?
(a)  Inverse Matrix                                  (b)  Sparse Matrix                 (c)  Determinant Matrix
(d)  Square Matrix                                  (e)  Transpose Matrix.
15.
Let there is a queue whose initial values for Front and Rear are 0 and 1 respectively. Later queue found to be having the elements 3, 2, 1, 5. If a new element is inserted in the queue, then which of the following statements is correct?
(a)   Front = 0 and Rear = 5
(b)   Front = 0 and Rear = 4
(c)   Front = 1 and Rear = 4
(d)   Front = 1 and Rear = 5
(e)   Insertion is not possible as there is no space in the queue.
16.
One from the following is also known as Pre-Order traversal. What that one is?
(a)  LNR                  (b)  LRN                  (c)  RLN                  (d)  RNL                  (e)  NLR.
17.
Which of the following data structure is the best example for the multitasking systems?
(a)  Tree                  (b)  Queue               (c)  Stack                (d)  Linked List        (e)  Graph.
18.
The initial configuration of the queue is having the elements ‘x, y, z, a’ forming a queue. To get the new configuration ‘a, z, y, x’ one needs a minimum of
(a)  3 additions and 4 deletion                (b)  3 deletions and 4 additions
(c)  3 deletions and 2 additions               (d)  3 deletions and 3 additions
(e)  4 deletions and 4 additions.
19.
To form the new configuration in the above problem, what best data structure is seems to be used?
(a)  Tree                  (b)  Queue               (c)  Linked List         (d)  Circular Queue   (e)  Stack.
20.
Recursive algorithms are based on
(a)  Divide and conquer approach           (b)  Top-down approach
(c)  Bottom-up approach                        (d)  Hierarchical approach                      
(e)  Heuristic approach.





Answers




11.
Answer : (a)
Reason:  Node 5 is a node generated if first element is taken and the second object is rejected. And just calculate as question(10).
12.
Answer : (c)
Reason:  Its  array [20][5] and hence 20 * 5.
13.
Answer : (e)
Reason:  Tree, according to the organization of tree a node may have a child and a parent also.
14.
Answer : (b)
Reason:  As sparse matrix is a matrix where the number of zeros are much than that of non zero elements.
15.
Answer : (a)
Reason:  As a new element is inserted at a position pointed by Rear, And Rear is incremented after insertion.
16.
Answer : (e)
Reason:  As in Pre-Order the traverse is as Node( root node), then Left node and Right node.
17.
Answer : (b)
Reason:  Because a queue is used to hold the jobs which are waiting for their turn to work with the common processor.
18.
Answer : (d)
Reason:  Because, first we have to delete ‘x’, ‘y’, ‘z’ and then insert ‘z’, ‘y’, ‘x’. And hence three deletions first followed by three additions.
19.
Answer : (e)
Reason:  As in the above discussion ‘x’ is deleted first but inserted at last. Hence there should be a stack to hold the deleted entries from above queue.
20.
Answer : (b)
Reason:  As in case of recursions the ARIs are created, and the recursive  function is called by other function first, then it calls itself util a condition is met.





3 comments :