1. Home
  2. Federal Board of Intermediate and Secondary Education (FBISE)
  3. Computer Science FBISE Class 10
  4. What is the output of printf("%d", 5 / 2); in C?

Added 16 Nov 2026

What is the output of printf("%d", 5 / 2); in C?

  1. 2.5
  2. 2 Correct answer
  3. 3
  4. 0

Correct answer

B. 2

10 views

MCQSEXAM

Explanation

Integer division truncates the decimal part. 5 / 2 = 2, not 2.5. To get 2.5, at least one operand must be a float. This is a common source of bugs.

Reference

Asked in: Matric,FBISE

Preparing for an exam?

Doubts & discussion

Not sure why the answer is B? 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