GATE CS 2019 · Question 37 · Programming and Data Structures · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

Consider the following C program:
#include <stdio.h> int r(){ static int num=7; return num--; } int main(){ for (r();r();r()) printf("%d",r()); return 0; }
Which one of the following values will be displayed on execution of the programs?

  1. (A) 41
  2. (B) 52
  3. (C) 63
  4. (D) 630
Answer

Answer (B)

Answer from the official GATE CS 2019 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes