CSE 2221 Midterm 2 Exam Prep 2025. | Exam Revision Questions And
Correct Answers | Graded A+ | 2025 Update |
Precondition - ANSWER- characterizes the responsibility of the program
that calls the method (the client)
Post-condition - ANSWER- Defines the responsibility of the implementing program
(developer) to ensure the method achieves certain conditions after execution.
Parameter Mode - ANSWER- A parameter mode specifies how a method can change the value
of the parameter passed to it.
Clears - ANSWER- A clears mode parameter is reset to its default value (e.g., 0, null) after the
method finishes. Any changes made within the method do not persist.
Restores - ANSWER- A restores mode parameter retains its original value after the method
finishes, regardless of any changes made inside the method.
Replaces - ANSWER- A parameter mode where the method may modify the parameter, but the
method's behavior does not depend on the original value.
Testing - ANSWER- Proving code has an error
Debugging - ANSWER- Finding and fixing an error in the code
Receivers - ANSWER- The formal parameters or implicit arguments of a method.
, Overloading - ANSWER- Having methods or variables with the same name, where the program
infers which one to call based on the argument type.
.copyFrom() - ANSWER- Copies values not references
.newInstance() - ANSWER- Creates an object without needing to know the implementation
class name in advance.
.compareTo() - ANSWER- Compares two objects, supporting relational operators like >, <, and
=.
Primitive types - ANSWER- Built-in types in Java (e.g., int, char) that represent values, not
objects.
Reference types - ANSWER- Types that refer to a memory location storing an object (e.g.,
arrays, classes).
Primitive variable - ANSWER- Variable of primitive type
Reference variable - ANSWER- Variable of reference type
Reference value - ANSWER- The memory address of a reference type at which an object is
stored
Object value - ANSWER- The actual value of a reference type
---> - ANSWER- Used to represent reference assignment, emphasizing that the variable holds
a reference, not a value.
Correct Answers | Graded A+ | 2025 Update |
Precondition - ANSWER- characterizes the responsibility of the program
that calls the method (the client)
Post-condition - ANSWER- Defines the responsibility of the implementing program
(developer) to ensure the method achieves certain conditions after execution.
Parameter Mode - ANSWER- A parameter mode specifies how a method can change the value
of the parameter passed to it.
Clears - ANSWER- A clears mode parameter is reset to its default value (e.g., 0, null) after the
method finishes. Any changes made within the method do not persist.
Restores - ANSWER- A restores mode parameter retains its original value after the method
finishes, regardless of any changes made inside the method.
Replaces - ANSWER- A parameter mode where the method may modify the parameter, but the
method's behavior does not depend on the original value.
Testing - ANSWER- Proving code has an error
Debugging - ANSWER- Finding and fixing an error in the code
Receivers - ANSWER- The formal parameters or implicit arguments of a method.
, Overloading - ANSWER- Having methods or variables with the same name, where the program
infers which one to call based on the argument type.
.copyFrom() - ANSWER- Copies values not references
.newInstance() - ANSWER- Creates an object without needing to know the implementation
class name in advance.
.compareTo() - ANSWER- Compares two objects, supporting relational operators like >, <, and
=.
Primitive types - ANSWER- Built-in types in Java (e.g., int, char) that represent values, not
objects.
Reference types - ANSWER- Types that refer to a memory location storing an object (e.g.,
arrays, classes).
Primitive variable - ANSWER- Variable of primitive type
Reference variable - ANSWER- Variable of reference type
Reference value - ANSWER- The memory address of a reference type at which an object is
stored
Object value - ANSWER- The actual value of a reference type
---> - ANSWER- Used to represent reference assignment, emphasizing that the variable holds
a reference, not a value.