Question 96Asked in BPSC TRE 3.0 (2024) Computer Science Class 11-12

#include <stdio.h> int main()

#include <stdio.h> int main() { int i = 5, j = 10, k = 15; printf("%d ", sizeof(k /=i+j)); printf("%d", k); return 0; } Assume size of an integer as 4 bytes. What is the output of above program?
  1. A2 1
  2. B4 1
  3. C4 15
  4. DMore than one of the above
  5. ENone of the above
Show answerHide answer

Correct answer: (C) 4 15

Explanation

sizeof only looks at the type of its operand and does not evaluate the expression, so k /= i+j never runs. It prints 4 (size of int), then k is still 15.

From BPSC TRE 3.0 (2024) Computer Science Class 11-12 — Previous Year Paper

This is question 96 of BPSC TRE 3.0 (2024) Computer Science Class 11-12 — Previous Year Paper. 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.