What does Console.WriteLine(“5” + 3 + 2); print in C#?
Correct answer A. 532
The + operator is evaluated left to right. "5" + 3 is string concatenation because one operand is a string, giving "53". Then "53" + 2 gives "532". By contrast, 3 + 2 + "5" first adds the two integers to get 5 and then concatenates, printing 55. Use parentheses, such as "5" + (3 + 2), to force the arithmetic first.
Answer checked How we write and check questions
Discussion