Comments should

Comments should

a) rephrase the code it explains in English
b) be insightful and explain what the instruction’s intention is
c) only be included in code that is difficult to understand
d) be used to define variables whose names are not easy to understand
e) all of the above


Answer:  b.

Explanation:  One might answer e, but that then includes a and c, making “all of the above” incorrect.  Comments should not rephrase in English what an instruction says, but instead should explain what that instruction is doing in relation to the program.  Introductory programmers often have difficult explaining their code and wind up stating the obvious in their comments.  While answer d is partially correct, it is not entirely true—all variables should have comments that explain their use.


Computer Science

Learn More Multiple Choice Question :