exam questions

Exam PCEP-30-02 All Questions

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

Exam PCEP-30-02 topic 1 question 60 discussion

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

What is the expected output of the following code?

  • A. 0 1
  • B. 1 0
  • C. The code is erroneous.
  • D. 0 0
Show Suggested Answer Hide Answer
Suggested Answer: C 🗳️

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
hovnival
1 month, 1 week ago
Selected Answer: C
The code you provided contains an error. Specifically, the method vals() does not exist for dictionary objects in Python. The correct method to retrieve the values of a dictionary is values(). Here's the corrected version of the code: data = {'1': '0', '0': '1'} for d in data.values(): print(d, end='')
upvoted 1 times
...
Nfyughguygjhg
2 months ago
Selected Answer: A
its AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
upvoted 1 times
...
Vano1
3 months ago
Selected Answer: C
.vals() method doesn't exist. The correct method is .values(). Therefore, the correct answer is C.
upvoted 3 times
...
pescamillam
3 months, 1 week ago
Selected Answer: C
Traceback (most recent call last): File "main.py", line 2, in <module> for d in data.vals(): AttributeError: 'dict' object has no attribute 'vals'
upvoted 2 times
...
SarangM
3 months, 2 weeks ago
Selected Answer: A
A is the correct answer
upvoted 2 times
...
Ragoo
3 months, 2 weeks ago
Run the code it shows the out out 0 1 data = {'1': '0', '0': '1'} for d in data.values(): print(d, end=' ') The answer is A
upvoted 2 times
Vano1
3 months ago
in the code is "data.vals()" which is erronous. Therefore, the correct answer is C.
upvoted 2 times
...
...
megan_mai
5 months, 1 week ago
Selected Answer: C
AttributeError: 'dict' object has no attribute 'vals' data.values() is the correct method
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