中等ICT-ALGO-004

A pass should be given for a mark of 50 or above. The algorithm says IF mark > 50 THEN OUTPUT "Pass" ELSE OUTPUT "Fail" ENDIF, and mark is 50. What is true?

A. The output is Fail, because 50 does not satisfy mark > 50.✓ 答案
B. The output is Pass, because 50 is a pass in everyday language.
C. Both Pass and Fail are output.
D. The algorithm cannot run, because IF is not allowed.

解說

Trace the condition that is written. 50 is not greater than 50, so ELSE runs. The mismatch with "50 or above" is a logic error, not a syntax error.

「演算法與偽代碼」全部 12 題 · 資訊及通訊科技 MCQ 題庫