nerdexam
Python_Institute

PCEP-30-02 · Question #91

Which of the following is the correct order of operator precedence?

The correct answer is C. Parentheses - Exponents - Unary positive, negative, not - Multiplication and Division - Addition and Subtraction - And. Option C correctly reflects the standard operator precedence hierarchy: Parentheses are always evaluated first since they explicitly group expressions, followed by Exponents, then Unary operators (like negation and logical not), then Multiplication/Division, then…

Question

Which of the following is the correct order of operator precedence?

Options

  • AExponents - Unary positive, negative, not - Parentheses - Multiplication and Division - Addition and Subtraction - And
  • BParentheses - Exponents - Unary positive, negative, not - Addition and Subtraction - Multiplication and Division - And
  • CParentheses - Exponents - Unary positive, negative, not - Multiplication and Division - Addition and Subtraction - And
  • DExponents - Unary positive, negative, not - Multiplication and Division - Addition and Subtraction - Parentheses

How the community answered

(35 responses)
  • A
    11% (4)
  • B
    3% (1)
  • C
    77% (27)
  • D
    9% (3)

Explanation

Option C correctly reflects the standard operator precedence hierarchy: Parentheses are always evaluated first since they explicitly group expressions, followed by Exponents, then Unary operators (like negation and logical not), then Multiplication/Division, then Addition/Subtraction, and finally logical And - which has the lowest precedence of the group.

Option A is wrong because it places Exponents at the top and buries Parentheses in the middle - parentheses always override everything else, so they must rank first. Option B is wrong because it swaps Multiplication/Division and Addition/Subtraction, violating the fundamental rule that multiplicative operations bind tighter than additive ones. Option D is wrong because it places Parentheses last, which is the exact opposite of their actual role.

Memory tip: Use the mnemonic PEUMAS - Parentheses, Exponents, Unary, Multiplication/Division, Addition/Subtraction - then tack logical operators (And/Or) on the end, since they evaluate after all arithmetic is resolved.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice