Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PCEP-30-02 All Questions

View all questions & answers for the PCEP-30-02 exam

Exam PCEP-30-02 topic 2 question 87 discussion

Actual exam question from Python Institute's PCEP-30-02
Question #: 9
Topic #: 2
[All PCEP-30-02 Questions]

You develop a Python application for your company. You have the following code.

Which of the following expressions is equivalent to the expression in the function?

  • A. (a + b) * (c - d)
  • B. (a + (b * c)) - d)
  • C. (a + ((b * c) - d)
  • D. None of the above.
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
5cd303a
1 week ago
Selected Answer: D
I would say D is the correct answer, as in B and C are each a parentheses missing.
upvoted 1 times
...
FedeXD
1 month, 3 weeks ago
B is correct. Multiplication has higher precedence than addition and substraction. Then for addition and substraction with the same precedence, left associativity is applied.
upvoted 1 times
...
Delroy2826
2 months, 3 weeks ago
value = 1 + 2 * 3 - 4 print(value) #3 value = (1 + (2 * 3)) - 4 print(value) #3 Hence B is correct
upvoted 1 times
...
S1nthe0
2 months, 4 weeks ago
Why does the system say that the correct answer is B? It means the system answers can't be trusted?
upvoted 2 times
...
christostz03
3 months ago
b is the correct answer According to the order of operations (PEMDAS/BODMAS), multiplication is performed before addition and subtraction. Specifically: Multiplication: b * c Addition: a + (result of b * c) Subtraction: (result of a + b * c) - d
upvoted 1 times
...
herrmann69
5 months, 2 weeks ago
Selected Answer: D
Answer D is correct. None of the above. A is wrong since multiplication has higher precedence than addition/subtraction B has a closing ")" too much C has an opening "(" too much
upvoted 3 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...