The return statement enables the exit of the program control from the current method. Given below…
Assertion: The return statement enables the exit of the program control from the current method.
Reason: If a method's return type is void, it can still contain return 0 statement to return nothing.
Given below are two statements marked, Assertion and Reason. Read the two statements carefully and choose the correct option.
- (a)Both Assertion and Reason are true and Reason is the correct explanation for Assertion.
- (b)Both Assertion and Reason are true but Reason is not the correct explanation for Assertion.
- (c)Assertion is true and Reason is false.
- (d)Both Assertion and Reason are false.
Answer
Answer
AIWritten by AI (antigravity) - it can contain mistakes.
Correct option: (c)
Answer: (c) Assertion is true and Reason is false.
The return statement terminates execution of the current method and returns control to the caller (Assertion is true). However, a method with return type void cannot return any value; 'return 0;' causes a compilation error (Reason is false).
From ISC 2026 Computer Science Paper 1, question 1(viii).