Lab 3
– Programming Style and Documentation
Post
Test
|
Lab Section: |
|
|
Name: |
|
1. Javadoc comments begin with the special
marker /**. True or false?
a. True
b. False
Answer: a
2. Comments can be used to:
I. Explain code whose purpose may not be obvious.
II. Compensate for poorly written code.
III. Summarize a block of code.
IV. Identify temporary code.
3. Wrong documentation is better than no documentation at all. True or false?
4. You can put a comment inside another
comment. True or false?
a. True
b. False
5. Where
is the best place to write a summary description for a method?
a. As the first sentence of a Javadoc comment for the method.
b. As the last sentence of a Javadoc comment for the method.
c. In the middle of a Javadoc
comment for the method.
d. Anywhere in the program.
e. It is not necessary to
write a summary description for a method.
Answer: a.
Comprehension:
6. Which of the following variable names is the best example of a self-documenting variable name?
Answer: c
a. Choose meaningful names for classes and methods.
8. For what audience should Javadoc
comments be written?
Answer: a
9. What is output by the Javadoc program?
I. HTML files containing the program’s documentation.
II. An index.
III. A hierarchy tree.
IV. Java source code.
10. Javadoc comments are useful because:
I. They allow us to automatically document our code.
II. They eliminate the need for other types of comments.
III. They allow us to easily generate documentation based on information included in the Java source code.
IV. They generate Java code that can be used by other programmers.
Answer: c