Vidyalelo
Python · Q21

Python Operator Precedence: MCQs for Exam Prep

Programming · Python · question 21

Q21

What is the result of 3 + 4 * 5 ?

A.
35
B.
23
Answer
C.
27
D.
47

Answer: Option B

Solution

Answer: Option B
Solution:
In Python, expressions are evaluated according to operator precedence, which determines the order in which operations are performed.

The multiplication operator (*) has higher precedence than the addition operator (+).

Therefore, in the expression 3 + 4 * 5, the multiplication is performed first.

First step: 4 * 5 = 20

Second step: 3 + 20 = 23

Thus, the final result of the expression is 23.

Hence, the correct answer is Option B: 23.