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 67 discussion

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

What is the expected output of the following code?
x = 4.5
y = 2
print(x // y)

  • A. 2.5
  • B. 2
  • C. 2.25
  • D. 2.0
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
6059a9b
2 weeks, 5 days ago
Selected Answer: D
tested on python
upvoted 1 times
...
akumo
1 month, 1 week ago
Selected Answer: B
i was trying ti write B. 2
upvoted 1 times
...
akumo
1 month, 1 week ago
Selected Answer: D
sorry it's D. 2.0
upvoted 1 times
...
akumo
1 month, 1 week ago
Selected Answer: D
5 // 2 = 2 (because 5 divided by 2 is 2.5, and we round it down to 2) 4.5 // 2 = 2.0 (because 4.5 divided by 2 is 2.25, and we round it down to 2.0)
upvoted 1 times
...
Oluwafemi_Akinlosotu
1 month, 2 weeks ago
Selected Answer: B
The answer is B because the // operator does floor division and returns a type depending on the input. Here, the input is a 4.5 of type float, hence "2.0".
upvoted 1 times
...
Billybob0604
5 months, 2 weeks ago
The answer should be B
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 ...
exam
Someone Bought Contributor Access for:
SY0-701
London, 1 minute ago