A directory of Objective Type Questions covering all the Computer Science subjects. Here you can access and discuss Multiple choice questions and answers for various compitative exams and interviews.

111. The time complexity of the following C function is (assume n > 0)

int recursive (int n) {
if (n == 1)
return (1);
else
return (recursive (n - 1) + recursive (n - 1));
}
a. O(n)
b. O(n log n)
c. O(n^2)
d. O(2^n)
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).O(2^n)

112. A program takes as input a balanced binary search tree with n leaf nodes and computes the value of a function g(x) for each node x. If the cost of computing g(x) is min{no. of leaf-nodes in left-subtree of x, no. of leaf-nodes in right-subtree of x} then the worst-case time complexity of the program is
a. Θ(n)
b. Θ(nLogn)
c. Θ(n^2)
d. Θ(n^2log n)
View Answer Report Discuss Too Difficult! Search Google
Answer: (b).Θ(nLogn)

113. Choose the best matching between the programming styles in Group 1 and their characteristics in Group 2.

 Group-1 Group-2
 P.  Functional 1. Command-based, procedural
 Q.  Logic   2. Imperative, abstract data type
 R.  Object-oriented  3. Side-effect free, declarative, expression evaluation
 S.  Imperative   4. Declarative, clausal representation, theorem proving
a. P-2, Q-3, R-4, S-1
b. P-4, Q-3, R-2, S-1
c. P-3, Q-4, R-1, S-2
d. P-3, Q-4, R-2, S-1
View Answer Report Discuss Too Difficult! Search Google
Answer: (d).P-3, Q-4, R-2, S-1

Page 12 of 12