Question 94Asked in DSSSB PGT Computer Science (Technical), 11 Jul 2021

What is output of the given code? void main ()

What is output of the given code? void main () { int a = 3, b, *p, **q; p = & a; q = & p; b = 2 * (**q + *p); cout << b; }
  1. A3
  2. B12
  3. C18
  4. D24
Show answerHide answer

Correct answer: (B) 12

Explanation

p points to a and q points to p, so **q = 3 and *p = 3. b = 2 × (3 + 3) = 12.

From DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021

This is question 94 of DSSSB PGT Computer Science PYQ (Technical), 11 Jul 2021. 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.