Question 75

Computer Awareness Data Structure Easy

When one object feference variable is assigned to another object reference variable, then

(A) a copy of the object is created
(B) a copy of thereference is not created
(C) it is illegal to assign one object reference variable to another object reference variable
(D) a copy of the refence is created
View Dynamic Solution & Explanation
Correct Solution: Option B

Step-by-step Solution:

When assigning one object reference variable to another, the reference itself is assigned, not the object. This means that both reference variables will now point to the same object in memory. Let's clarify each option: \[\] (a) a copy of the object is created: This is incorrect because assigning a reference does NOT involve copying the actual object. \[\] - (b) a copy of the reference is not created: Correct because the reference is just assigned, and no new memory is allocated for the object. \[\] - (c) it is illegal to assign one object reference variable to another object reference variable: Incorrect because reference assignment is valid in most object-oriented languages like Java or C++. \[\] - (d) a copy of the reference is created: Incorrect because only the reference itself is shared between the two variables, with no new copies being created. \[\] Correct Answer: (b)