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

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

What is the output of the following snippet?

  • A. [1, 2, 3]
  • B. [3, 3, 3]
  • C. [3, 2, 1]
  • D. [1, 1, 1]
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
2 days, 20 hours ago
Selected Answer: C
The correct answer is: C. [3, 2, 1] Explanation: The code iterates over each element v in my_list_1 and inserts v at the beginning (index 0) of my_list2. This results in reversing the order of the elements from my_list_1 in my_list2. Here is the step-by-step process: v = 1 -> my_list2.insert(0, 1) -> my_list2 becomes [1] v = 2 -> my_list2.insert(0, 2) -> my_list2 becomes [2, 1] v = 3 -> my_list2.insert(0, 3) -> my_list2 becomes [3, 2, 1] Therefore, the final output of print(my_list2) is [3, 2, 1].
upvoted 1 times
...
christostz03
4 months, 1 week ago
c 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