1. Home
  2. Federal Board of Intermediate and Secondary Education (FBISE)
  3. Computer Science FBISE Class 10
  4. What is the output of the following code? int x = 5…

Added 16 Nov 2026

What is the output of the following code? int x = 5; printf("%d", x++);

  1. 5 Correct answer
  2. 6
  3. 7
  4. 4

Correct answer

A. 5

11 views

MCQSEXAM

Explanation

The postfix ++ returns the current value (5) and then increments x to 6. So the output is 5. If it were ++x, the output would be 6. This distinction is a classic exam question.

Reference

Asked in: Matric,FBISE

Preparing for an exam?

Doubts & discussion

Not sure why the answer is A? Ask here and get an explanation.

Ask a doubt about this MCQ

Shown after review. No links please.

More Computer Science FBISE Class 10 MCQs

Practise all Computer Science FBISE Class 10 MCQs

Similar MCQs