MCQ Practice Single Best Answer Topic: ICSE Computer Application - Class X - 2025 PYQ

Q Consider the following program segment in which the statements are jumbled.

Choose the correct order of statements to calculate and return the factorial of 4.

  1. for (k=1; k<=4; k++)

  2. return fa;

  3. long fa = 1, k;

  4. fa *= k;

Question ID
#24168
Subchapter
ICSE Computer Application - Class X - 2025 PYQ
Action
Choose one option below

Choose Your Answer

Click an option to check whether your answer is correct.

  • A 1, 2, 3, 4
  • B 3, 1, 4, 2
  • C 3, 1, 2, 4
  • D 1, 3, 2, 4
Correct Answer: B

Explanation

(b) 3, 1, 4, 2

Correct Order:

  1. long fa = 1, k; → (Initialize fa to store factorial)

  2. for (k=1; k<=4; k++) → (Loop through numbers 1 to 4)

  3. fa *= k; → (Multiply fa by k in each iteration)

  4. return fa; → (Return the computed factorial)

Share This Question

Share this MCQ with your friends or study group.