You are here : Home >> All Company Study Materials >> Amcat Archive >> Amcat Technical Questions
Q31. Rajini is given an efficient code for summing two nXn matrices and putting the result in a third matrix. She is asked to find it’s time complexity. She realizes that the number of iterations required is more than n. What can she claim with regard to the complexity of the code?
A. It is O(n)
B. It is O(n2)
C. It is THETA(n)
D. It is &omega(n)
Ans. D
Q32. Gautam is given two codes, A and B, to solve a problem, which have complexity THETA(n) and THETA(n2) respectively. His client wants to solve a problem of size k, which Gautam does not know. Which code will Gautam deliver to the client, so that the execution is faster?
A. Code A
B. Code B
C. Gautam cannot determine
D. Both codes have the same execution time, so deliver any.
Ans. C
Q33. Surbhi is given two codes, A and B, to solve a problem, which have complexity O(n3) and &omega(n4) respectively. Her client wants to solve a problem of size k, which is sufficiently large. Which code will Surbhi deliver to the client, so that the execution is faster?
A. Code A
B. Code B
C. Surbhi cannot determine
D. Both codes have the same execution time, so deliver any.
Ans. A
Q34. Vibhu is given two codes, A and B, to solve a problem, which have complexity O(n4) and &omega(n3) respectively. Her client wants to solve a problem of size k, which is sufficiently large. Which code will Gautam deliver to the client, so that the execution is faster?
A. Code A
B. Code B
C. Vibhu cannot determine
D. Both codes have the same execution time, so deliver any.
Ans. C
Q35. What does the following function do?
function operation (int a, int b)
{
if (a < b)
{ return operation(b, a) }
else
{ return a }
}
A. Returns the max of (a,b)
B. Returns the min of (a,b)
C. Loops forever
D. Always returns the second parameter
Ans. A