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

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

What is the expected output of the following code?

  • A. 2 4
  • B. 1 3
  • C. 3 1
  • D. 4 2
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

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
2 days, 10 hours ago
Selected Answer: A
The expected output of the given code is: 24 Explanation: The dictionary data is created with two keys: '2' and '1'. data['2'] = [1, 2] data['1'] = [3, 4] The for loop iterates over the keys of the dictionary data. For each key i, the code prints the second element (index 1) of the corresponding list. For the key '2', data['2'][1] is 2. For the key '1', data['1'][1] is 4. The end='' argument in the print function ensures that the outputs are printed on the same line without any spaces in between. Therefore, the output is 24.
upvoted 1 times
...
vestersly
4 months, 1 week ago
A, is correct because the index 1 in from the loop iteration is 2, and 4.
upvoted 2 times
...
christostz03
4 months, 1 week ago
a is the correct answer
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