MCQ Hive stays free thanks to ads. Please disable your ad blocker for this site so content and features keep working.
Data Types
Type Conversion & Casting
Beginner
Q
What does std::cout
AB
BA1
C66
DCompilation error
Correct Answer:
C. 66
Explanation:
'A' is promoted to int (65), and 65 + 1 = 66 prints as a number. Write (char)('A' + 1) to print B.
ALSO KNOW (related points):
• Which C++ cast checks at run time whether a downcast is valid, and requires a polymorphic base class? → dynamic_cast
• Which statement about C++'s auto keyword (C++11) is correct? → The type is deduced at compile time, and the variable stays statically typed