What this C++ type-system question tests
This is a straightforward easy question that probes your understanding of how the C++ compiler resolves types in arithmetic expressions. It looks simple on the surface, but careless reasoning about implicit conversions can trip up even experienced candidates.
The question asks you to read a code snippet and determine the resulting type after a specific operation. To answer correctly, you need to know the C++ rules for arithmetic type promotion—how the compiler upcasts operands before performing operations, and what type the result takes. This is foundational knowledge for writing correct, predictable code, especially in performance-critical domains where unexpected type conversions can mask bugs or degrade efficiency.
- Integral type promotion rules
- Arithmetic conversions in binary operations
- Distinction between operand types and result types