OA. free
Free
IBM Quantitative Aptitude Core Computer Science Medium

Writing comments in source code:

IBM aptitude question, verified with a worked answer. Free to practise - no sign-up.

Writing comments in source code:

Choose one option.
Show answer & explanation
Answer: B. Is a good programming practice

Comments are stripped by the compiler/interpreter during preprocessing and do not appear in the compiled executable (.exe), so they don't affect file size, compilation time significantly, or runtime performance. Writing comments is a fundamental software engineering best practice as it improves code readability, maintainability, and helps other developers (and future you) understand the logic and intent behind the code.

Step-by-step Derivation:
Analysis of each option:

  • Option A: False. Comments are removed during compilation; they don't appear in the final .exe.
  • Option B: True. Comments enhance code clarity and documentation—a core best practice in software engineering.
  • Option C: False. Comment parsing adds negligible compilation time compared to actual code compilation.
  • Option D: False. Comments are completely removed before execution, so they have zero runtime overhead.
    Conclusion: The correct answer is B.