Assertion (A): A recursive function that calls itself before printing the current character will output the string in reverse order.
Reason (R): The print statement is deferred until the call stack unwinds, causing the last character processed to be printed first.
A
Step-by-Step Solution
Key idea: This is an assertion-reason question about string reversal using recursion.
Step 1: Evaluate Assertion (A). Calling the function before printing defers the print to the ascent phase, reversing the string. (A is true).
Step 2: Evaluate Reason (R). The print is indeed deferred until the stack unwinds, meaning the deepest call (last character) prints first. (R is true).
Step 3: Check if R explains A. Yes, the deferred execution on the unwinding stack is exactly why the string is reversed.
Answer: Both A and R are true and R is the correct explanation of A.