Writing Classes in AP Computer Science A
Which type of comment may include preconditions and postconditions?
Block comments
Multi-line comments
Single-line comments
Javadoc comments
Which type of code is typically ignored by the compiler and does not affect the execution of the program?
Statements
Comments
Annotations
Directives
What is the primary reason for using Javadoc comments in a Java program?
To provide step-by-step instructions on how to compile and run the program.
To automatically generate standardized API documentation from source code.
To add detailed explanations inside methods for complex algorithms.
To indicate changes and updates made during different versions of the program.
When documenting code that includes both iterative and recursive solutions to calculate Fibonacci numbers, what comment correctly justifies the use of recursion despite potential performance concerns?
Recursive solution used for educational purposes though iterative may be more efficient due to stack overflow risk with large inputs.
Recursion chosen as it enables parallel computation of Fibonacci numbers yielding faster runtime on multi-core processors.
Iterative version avoided because recursion offers better space complexity by reducing variable usage within loops.
Recursion provides a clearer and more concise code structure, which outweighs any efficiency gains from iteration.
What potential disadvantage could arise from choosing inheritance over composition in large-scale object-oriented programming projects?
The final classes are immutable, preventing further extension through additional subclassing or modification.
There could be increased complexity due to deep hierarchy trees which can make maintenance difficult.
Objects become less reusable because they are limited to single-inheritance structures in certain languages like Java.
Performance overhead increases dramatically as objects require more memory space due to inherited properties.
What kind of information would typically NOT be included in documentation comments?
The parameters used by a method.
The return value type and its meaning.
A description of what a method does.
The author's personal opinion about unrelated topics.
When documenting code, which audience should you keep in mind while writing comments?
Customers who purchased software products.
People looking for entertainment while reading source codes.
Computers that compile your source codes.
Other developers who may read or maintain your code.

How are we doing?
Give us your feedback and let us know how we can improve
Where would you typically place a block comment in Java?
At the end of each line of code for clarification purposes only.
After main method declaration exclusively.
Typically before a block of code to explain its purpose or logic.
In random locations as long as it's somewhere within your class file.
Which type of comment is used for comments on one line of code?
Javadoc comments
Multi-line comments
Inline comments
Single-line comments
In documenting recursive methods, what type of comment best facilitates comprehension while showcasing complex problem-solving skills?
Explaining the base case and recursive step with respect to how they contribute to solving the larger problem.
Listing all parameters passed in every recursive call without illustrating their purpose.
Describing what each variable represents in every step of recursion without context.
Outlining every possible recursive call stack scenario in detail before actual execution.