Sail E0 Webinar

MCQs

Total Questions : 36 | Page 2 of 4 pages
Question 11.
Dynamic Programming fails for which of the following problems?



  1.    8-Queens problem
  2.    0/1 Knapsack problem
  3.    Fractional Knapsack problem
  4.    Matrix chain multiplication problem
 Discuss Question
Answer: Option A. -> 8-Queens problem


Question 12.
Complexity of following segment of code is:
for(i=n;i>=1;i=i/2)
for(j=1;j<=i;j++)
{
-------------some code
}



  1.    O(n^2/2)
  2.    O(nlog n)
  3.    O((log n)^2 )
  4.    O(n)
 Discuss Question
Answer: Option B. -> O(nlog n)


Question 13.
Given 5 numbers X1, X2, X3, X4, X5. How many comparisons are needed to
find the median of the numbers using the most efficient way?



  1.    5
  2.    6
  3.    7
  4.    8
 Discuss Question
Answer: Option B. -> 6


Question 14.
A d-ary heap is a like a binary heap, but (with one possible exception)
non-leaf nodes have d children instead of 2 children. What would be
the procedures to map a node with index i to its parent and its jth
child, given the heap is represented using an array.



  1.    PARENT(i):return floor((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i - 1) + j + 1
  2.    PARENT(i):return ceil((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i) + j
  3.    PARENT(i):return floor((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i) + j + 1
  4.    PARENT(i):return ceil((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i - 1) + j
 Discuss Question
Answer: Option A. -> PARENT(i):return floor((i-2)/d+ 1) D-ARY-CHILD(i; j):return d(i - 1) + j + 1


Question 15.
Let a be a Fibonacci-heap with n elements that results from a sequence
of insert, combine, delete min, delete and decrease key operations
performed on initially empty F-heaps. Let b be any node in any of the
min-trees of a. What is the maximum degree of b?(m=no. of elements in
the sub tree with root b, φ=(1+√5)/2 ).



  1.    log mφ
  2.    logm/logφ
  3.    log m + logφ
  4.    None of these
 Discuss Question
Answer: Option B. -> logm/logφ


Question 16.
What will be the ordering of the vertices produced by TOPOLOGICAL SORT when it is run
on the directed acyclic graph as shown below:

What Will Be The Ordering Of The Vertices Produced By TOPOLO...



  1.    v0,v3,v2,v5,v1,v4
  2.    v4,v1,v5,v2,v3,v0
  3.    No topological sorting is possible in this case
  4.    None of these
 Discuss Question
Answer: Option A. -> v0,v3,v2,v5,v1,v4


Question 17.
For a heap of n nodes, maximum no. of nodes in the left subtree are



  1.    always
  2.    >2n/3 is possible
  3.    always n/2
  4.    always (n-1)/2
 Discuss Question
Answer: Option B. -> >2n/3 is possible


Question 18.
The postfix string for the input (((A-(B+C))*D)$(E+F)) :



  1.    $*-A+BCD+EF
  2.    ABC+-D*EF+$
  3.    ABC+-DEF+$-
  4.    ABC+D*-EF+$
 Discuss Question
Answer: Option A. -> $*-A+BCD+EF


Question 19.
Given 5 vertices, number of spanning trees possible are:



  1.    125
  2.    120
  3.    24
  4.    2^5
 Discuss Question
Answer: Option B. -> 120


Question 20.
Maximum worst case complexity of cycle detection in a directed graph:



  1.    O(exn)
  2.    O(e+n)
  3.    O(e(e+n))
  4.    O(n^2)
 Discuss Question
Answer: Option B. -> O(e+n)


Latest Videos

Latest Test Papers