Question Detail

COS 102 test topic Objective Question

Question

Which of the following is considered an explicit type conversion (type casting)?
Options
A Automatic promotion of int to float during addition
B Writing `(int) 3.14` to truncate a floating-point value
Correct Answer
C Compiling high-level code to assembly
D Passing a character literal into a print routine
Correct Answer

Option B is the correct answer.

Detailed Explanation

Explicit type casting requires the programmer to explicitly specify the target type using syntax such as (type) value.

Hint

No hint available

Question Info