Question 131

What is the output? #define SQ(x) x*x

What is the output? #define SQ(x) x*x printf("%d", SQ(3+1));
  1. A10
  2. B16
  3. C9
  4. D7
Show answerHide answer

Correct answer: (D) 7

Explanation

Expands to 3+1*3+1 = 7 (no brackets in the macro).

From DSSSB TGT Computer Science Full Mock Test 2

This is question 131 of DSSSB TGT Computer Science Full Mock Test 2. See all questions of this paper with answers, or attempt the paper as a timed online test to get your score and all-India rank.