ExamVeda
Login
Home
Operators and Expressions in C plus plus
?

What is the result of the expression: 5 + 3 * 2 in C++?

Answer & Solution
Correct Answer: Option A
The correct answer is B: 11

Let's break down why:

C++ follows the standard order of operations (often remembered by the acronym PEMDAS/BODMAS).
This means:

* Parentheses/Brackets (None in this expression)
* Exponents/Orders (None in this expression)
* Multiplication and Division (from left to right)
* Addition and Subtraction (from left to right)

In the expression 5 + 3 * 2:

1. First, we perform the multiplication: 3 * 2 = 6
2. Then, we perform the addition: 5 + 6 = 11

Therefore, the result of the expression is 11.
Option A (16) is incorrect because it doesn't follow the order of operations (it would result from doing 5+3 first).
Option C (10) is incorrect for the same reason.
Option D (Compiler error) is incorrect. The expression is perfectly valid in C++ and will compile and run.
Examveda
Question posted by Examveda
Community

Join the Discussion

1 Comment
Gopal Ambore
Gopal Ambore 11 months ago
The Answer for this question is wrong. It should be 11 not 16.