QUESTIONS WITH SOLUTIONS GRADED A+
◉Precondition . Answer: A condition that must be true before a specific
operation or method is invoked. It specifies the requirements or
constraints that need to be satisfied for the operation to execute safely.
◉Postcondition . Answer: A condition that must be true after a specific
operation or method has executed. It defines the expected state or
outcome resulting from the execution of the operation.
◉Testing . Answer: The process of evaluating a software system by
executing it with the intent of finding defects or verifying that it meets
its specified requirements.
◉Debugging . Answer: The process of identifying and fixing errors or
defects in software to make it behave as intended.
◉Parameter mode . Answer: Specifies how a parameter is treated within
a method or function. Common parameter modes include "in" (read-
only), "out" (write-only), and "inout" (read and write).
, ◉Clears . Answer: A design-by-contract annotation indicating that a
method clears or modifies the state of an object, potentially removing its
previous content.
◉Replaces . Answer: A design-by-contract annotation indicating that a
method replaces the current state of an object with a new state,
effectively discarding its previous content.
◉Restores . Answer: A design-by-contract annotation indicating that a
method restores an object's state to a previous state.
◉Updates . Answer: A design-by-contract annotation indicating that a
method updates the state of an object, potentially modifying it while
retaining some of its previous content.
◉Immutable type . Answer: A type of object whose state cannot be
modified after it is created. Immutable objects guarantee that their state
remains constant throughout their lifetime.
◉Primitive type . Answer: A basic data type built into a programming
language, such as integers, floating-point numbers, or characters.
◉Reference type . Answer: A data type that stores references or
memory addresses to objects rather than the actual data. Objects are
accessed indirectly through references.