Advertisements
Advertisements
Question
Assertion(A): call by value is known as pure method.
Reason(R): The original value of variable does not change as operation is performed on copied values.
Options
Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
Both Assertion (A) and Reason (R) are true and Reason (R) is not a correct explanation of Assertion (A).
Assertion (A) is true and Reason (R) is false.
Assertion (A) is false and Reason (R) is true.
MCQ
Assertion and Reasoning
Advertisements
Solution
Both Assertion (A) and Reason (R) are true and Reason (R) is a correct explanation of Assertion (A).
Explanation:
- The Assertion is True: A method is considered "pure" if it does its job without changing the outside data (no side effects).
- The Reason is True: Call-by-value makes a separate copy of the variable for the method to use.
- The explanation matches: Because the method only works on a copy, the original value never changes. This lack of side effects is exactly what makes it a pure method.
shaalaa.com
Is there an error in this question or solution?
