Gate CS-2014-1 Question Paper With Solutions

Q. 52 Consider the following pseudo code. What is the total number of multiplications to be performed?

D = 2
for i = 1 to n do
   for j = i to n do
      for k = j + 1 to n do
           D = D * 3

(A) Half of the product of the 3 consecutive integers

(B) One-third of the product of the 3 consecutive integers.

(C) One-sixth of the product of the 3 consecutive integers

(D) None of the above

Answer: (C)

Explanation:

Gate CS-2014-1 Question Paper With Solutions Gate CS-2014-1 Question Paper With Solutions

Learn More:   Gate ME-2020-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here