nerdexam
Python_Institute

PCEP-30-02 · Question #68

You develop a Python application for your company. You have the following code. def main(a, b, c, d): value = a + b * c - d return value Which of the following expressions is equivalent to the…

The correct answer is D. None of the above. Option D is correct because choices B and C are identical expressions - (a + (b c) - d) - and a well-formed multiple-choice question cannot have two duplicate correct answers; since selecting just B or just C would mean ignoring an equally valid option, neither stands alone as…

Question

You develop a Python application for your company. You have the following code. def main(a, b, c, d): value = a + b * c - d return value Which of the following expressions is equivalent to the expression in the function?

Options

  • A(a + b) * (c - d)
  • B(a + (b * c) - d)
  • C(a + (b * c) - d)
  • DNone of the above.

How the community answered

(59 responses)
  • A
    7% (4)
  • B
    10% (6)
  • C
    3% (2)
  • D
    80% (47)

Explanation

Option D is correct because choices B and C are identical expressions - (a + (b * c) - d) - and a well-formed multiple-choice question cannot have two duplicate correct answers; since selecting just B or just C would mean ignoring an equally valid option, neither stands alone as the unique answer.

Why A is wrong: (a + b) * (c - d) groups the addition and subtraction inside parentheses before the multiplication, completely changing Python's default operator precedence and producing a different result.

Why B and C are wrong (as choices): Even though (a + (b * c) - d) is mathematically equivalent to a + b * c - d - Python's precedence rules evaluate * before + and - - having two identical options makes the question structurally unsound, which is the trap the question is setting.

Memory tip: Whenever you spot two identical-looking answer choices, that's your signal to immediately consider "None of the above." Also lock in this Python precedence rule: Multiplication before Addition/Subtraction, always left-to-right for same-level operators (a + b * c - da + (b*c) - d).

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice