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

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

What is the expected output of the following code?

  • A. 4
  • B. 2
  • C. 10
  • D. 0
  • E. 1
  • F. 3
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
1 day, 22 hours ago
Selected Answer: A
The given code creates a set from a list containing duplicate elements and then prints the length of the set. Let's analyze it step-by-step: data = set([1, 2, 2, 3, 3, 3, 4, 4, 4, 4]) This creates a set from the list [1, 2, 2, 3, 3, 3, 4, 4, 4, 4]. Since sets do not allow duplicate elements, the resulting set will be {1, 2, 3, 4}. print(len(data)) This prints the length of the set data. The set {1, 2, 3, 4} has 4 unique elements. Therefore, the expected output of the code is: 4
upvoted 1 times
...
christostz03
4 months, 1 week ago
a 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