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

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

Take a look at the snippet and choose one of the following statements which is true:

  • A. vals is longer than nums
  • B. nums and vals are of the same length
  • C. nums is longer than vals
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, 2 weeks ago
Selected Answer: B
The correct answer is: B. nums and vals are of the same length Explanation: In Python, lists are mutable objects. The assignment vals = nums does not create a new list; it simply creates a reference to the same list object. Therefore, both nums and vals point to the same underlying list. When vals.append(1) is executed, it modifies the shared list. As a result, both nums and vals will have the same length (and the same content) because they are essentially two names for the same object.
upvoted 1 times
...
christostz03
5 months, 2 weeks ago
b is correct answer
upvoted 1 times
Nfyughguygjhg
2 months ago
how do you know?
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