Skip to content
Related Articles

Related Articles

Improve Article

GATE | GATE 2017 MOCK II | Question 19

  • Last Updated : 28 Jun, 2021

Consider the following pseudo code.

x = 0;
for (i = 1 to n)
  for (j = 1 to 4i – 3)
    x = x + 1

Find the value of x, when the above code is executed in a function.

(A) n
(B) 2n2 – n
(C) 2n2 – 1
(D) 2n


Answer: (B)

Explanation: output

Quiz of this Question

Attention reader! Don’t stop learning now.  Practice GATE exam well before the actual exam with the subject-wise and overall quizzes available in GATE Test Series Course.

Learn all GATE CS concepts with Free Live Classes on our youtube channel.

My Personal Notes arrow_drop_up
Recommended Articles
Page :