Data Structures

1:

L:et m, n be positive integers. Define Q (m, n) as

Q (m, n) = 0, if m>n

Then Q (m, 3) is (a div b, gives the quotient when a is divided by b)

 

A.

a constant

B.

p x (m mod 3)

C.

p x (m div 3)

D.

3 x p

 

Answer : C

Explanation :

Let m>n. Let m/n yield a quotient x and remainder y. So, m= n*x+y and y<m div 3 is the quotient when m is divided by 3. So, that many times p is added, before we terminate recursion by satisfying the end condition Q (m,n) = 0 if m<n. Hence the result.

Write your comments here:


Report Error
 

Option: A

Explanation : Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here. Explanation will come here.