Difficulty: Medium
Correct Answer: A0
Explanation:
Introduction / Context:
This program prints a number in base 13 using digits 0–9 and letters A, B, C for 10, 11, 12 respectively. The method Modify transforms Num by repeatedly dividing by 13, recursing for higher places, and then printing the current remainder as a base-13 digit.
Given Data / Assumptions:
Concept / Approach:
Converting to base 13: at each step compute Dec = Num % 13 and Num = Num / 13. Recurse if Num > 0 to print the more significant digits first; then print the symbol for Dec. This is the standard recursive number-to-base printing pattern.
Step-by-Step Solution:
Verification / Alternative check:
130 in base 13 equals 10*13 + 0, so the digits are 10 and 0 → A0. Printing order matches the recursion.
Why Other Options Are Wrong:
Common Pitfalls:
Expecting 13 to produce a remainder of 13 (remainders are 0–12), or forgetting that the routine prints higher-order digits first by recursing before output.
Final Answer:
A0
Discussion & Comments