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 #: 87
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: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
FedeXD
1 month 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 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, 1 week ago
Why does the system say that the correct answer is B? It means the system answers can't be trusted?
upvoted 1 times
...
christostz03
2 months, 1 week 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
4 months, 4 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 2 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 ...