Multiple choice technology programming languages

A simple macro to double a number was written as follows #define double(X) X*X #include using namespace std; int main() { std::cout<

  1. 12

  2. 15

  3. 10

  4. 9

  5. Compilation error

  6. 24

Reveal answer Fill a bubble to check yourself
B Correct answer
Explanation

The macro expands double(3+3) literally to 3+3*3+3. Due to operator precedence, multiplication is evaluated first (3*3=9), yielding 3+9+3, which equals 15.