CSE 2221 Midterm 2 2025 Revision. | Exam Revision Questions And Correct
Answers | Graded A+ | 2025 Update |
Kernel Interface Design - Answer The core interface of a class that defines essential
methods required for the class's functionality. It focuses on simplicity and consistency, forming the
foundation for other methods and functionality.
Constructor - Answer A special method used to initialize objects. When a new object is
created, the constructor is called to set initial values for the object's fields.
No-Argument Constructor - Answer A constructor that takes no parameters and initializes
an object with default values. If no constructors are explicitly defined, Java provides a default no-
argument constructor.
Copy Constructor - Answer A constructor that creates a new object as a copy of an existing
object, typically taking an object of the same class as an argument and replicating its state.
Instance Method - Answer A method that operates on an instance of a class (an object). It
can access and modify the instance's fields (data members).
Receiver - Answer The object on which an instance method is invoked. In Java, this is
implicitly represented by this, referring to the current object inside instance methods.
Distinguished Formal Parameter - Answer A special kind of formal parameter that plays a
significant role in the method's logic. In Java, this often refers to this, especially in constructors
and instance methods, where it distinguishes the current object from other parameters.
Parameter Modes - Answer Describes how arguments are passed to methods and affect
parameters.
@restores - Answer The argument is restored to its initial state after the method call.
@updates - Answer The argument is modified by the method.
, @replaces - Answer The argument is replaced by a new value.
@clears - Answer The argument is set to a cleared state.
Default Parameter Mode - Answer In Java, parameters are passed by value, which means a
copy of the value is passed to methods. For reference types, the reference (address) is copied, not
the object itself.
Primitive Type - Answer Basic data types built into Java, such as int, char, double, and
boolean. They store actual values rather than references to objects.
Reference Type - Answer A type that refers to an object. It stores a reference (or memory
address) to the object rather than the object itself. Examples include String, arrays, and any user-
defined class types.
Immutable Reference Type - Answer A reference type whose value cannot be modified after
creation, such as String. Even though you can assign a new value, the object itself doesn't change.
Mutable Reference Type - Answer A reference type that can be changed after creation, such
as arrays or objects of custom classes.
Reference Diagrams - Answer Visual representations of how variables point to objects in
memory, helping to illustrate how references work in Java.
Reference Value - Answer The memory address or reference to the location of an object. It
is what reference types store rather than the actual object data.
Object Value - Answer The actual data stored in an object, as opposed to the reference to
the object.
Assignment Operator (with Reference Types) - Answer When assigning one reference
variable to another, both variables will refer to the same object in memory.
Call-by-Copy (with Reference Types) - Answer When passing a reference type as an
argument to a method, Java passes a copy of the reference, meaning the method can modify the
object, but not the reference itself.
Answers | Graded A+ | 2025 Update |
Kernel Interface Design - Answer The core interface of a class that defines essential
methods required for the class's functionality. It focuses on simplicity and consistency, forming the
foundation for other methods and functionality.
Constructor - Answer A special method used to initialize objects. When a new object is
created, the constructor is called to set initial values for the object's fields.
No-Argument Constructor - Answer A constructor that takes no parameters and initializes
an object with default values. If no constructors are explicitly defined, Java provides a default no-
argument constructor.
Copy Constructor - Answer A constructor that creates a new object as a copy of an existing
object, typically taking an object of the same class as an argument and replicating its state.
Instance Method - Answer A method that operates on an instance of a class (an object). It
can access and modify the instance's fields (data members).
Receiver - Answer The object on which an instance method is invoked. In Java, this is
implicitly represented by this, referring to the current object inside instance methods.
Distinguished Formal Parameter - Answer A special kind of formal parameter that plays a
significant role in the method's logic. In Java, this often refers to this, especially in constructors
and instance methods, where it distinguishes the current object from other parameters.
Parameter Modes - Answer Describes how arguments are passed to methods and affect
parameters.
@restores - Answer The argument is restored to its initial state after the method call.
@updates - Answer The argument is modified by the method.
, @replaces - Answer The argument is replaced by a new value.
@clears - Answer The argument is set to a cleared state.
Default Parameter Mode - Answer In Java, parameters are passed by value, which means a
copy of the value is passed to methods. For reference types, the reference (address) is copied, not
the object itself.
Primitive Type - Answer Basic data types built into Java, such as int, char, double, and
boolean. They store actual values rather than references to objects.
Reference Type - Answer A type that refers to an object. It stores a reference (or memory
address) to the object rather than the object itself. Examples include String, arrays, and any user-
defined class types.
Immutable Reference Type - Answer A reference type whose value cannot be modified after
creation, such as String. Even though you can assign a new value, the object itself doesn't change.
Mutable Reference Type - Answer A reference type that can be changed after creation, such
as arrays or objects of custom classes.
Reference Diagrams - Answer Visual representations of how variables point to objects in
memory, helping to illustrate how references work in Java.
Reference Value - Answer The memory address or reference to the location of an object. It
is what reference types store rather than the actual object data.
Object Value - Answer The actual data stored in an object, as opposed to the reference to
the object.
Assignment Operator (with Reference Types) - Answer When assigning one reference
variable to another, both variables will refer to the same object in memory.
Call-by-Copy (with Reference Types) - Answer When passing a reference type as an
argument to a method, Java passes a copy of the reference, meaning the method can modify the
object, but not the reference itself.