ISRO Computer Science (CSE) 2014 - Question 3

All ISRO Computer Science (CSE) papers | ISRO Computer Science (CSE) 2014

What is the output of the following C program?\n```c\n#include <stdio.h>\n#define SQR(x) (x*x)\nint main ()\n{ \n int a, b = 3;\n a = SQR (b + 2);\n printf("%d\n", a);\n return 0;\n}\n```

  • A. 25
  • B. 11
  • C. 15
  • D. None of the above

Answer: B. 11

Explanation: The macro `SQR(b + 2)` expands to `(b + 2 * b + 2)`. \nWith $b=3$, this becomes $3 + 2 * 3 + 2 = 3 + 6 + 2 = 11$.

| | All questions of ISRO Computer Science (CSE) 2014