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

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

What is the expected output of the following code?

  • A. 7 23 42
  • B. 7 42 23
  • C. 42 23 7
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

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: B
The code provided will output the values of the dictionary data in the order of their keys sorted alphabetically. Here is a step-by-step explanation: The dictionary data is defined as {'z': 23, 'x': 7, 'y': 42}. The sorted(data) function sorts the keys of the dictionary alphabetically, resulting in the list ['x', 'y', 'z']. The for loop iterates over this sorted list of keys. During each iteration, the corresponding value from the dictionary is accessed using the key and printed with a space as the separator. So, the expected output of the code is: 7 42 23
upvoted 1 times
...
christostz03
5 months, 2 weeks ago
b is the correct answer
upvoted 1 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