Examveda

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

A. 16

B. 11

C. 10

D. Compiler error

Answer: Option A

Solution (By Examveda Team)

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.

Join The Discussion

Comments (1)

  1. Gopal Ambore
    Gopal Ambore:
    2 days ago

    The Answer for this question is wrong. It should be 11 not 16.

Related Questions on Operators and Expressions in C plus plus