Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam PCAP All Questions

View all questions & answers for the PCAP exam

Exam PCAP topic 1 question 55 discussion

Actual exam question from Python Institute's PCAP
Question #: 55
Topic #: 1
[All PCAP Questions]

Assuming that 1 -
is a four-element list is there any difference between these two statements?

  • A. yes, there is, the first line empties the list, the second line deletes the list as a whole
  • B. yes, there is, the first line deletes the list as a whole, the second line just empties the list
  • C. no, there is no difference
  • D. yes, there is, the first line deletes the list as a whole, the second line removes all the elements except the first one
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
TheFivePips
11 months, 3 weeks ago
Selected Answer: B
Some of these questions are so confusing to read at a first. Here is an example to show what the hell they are talking about first = [1,2,3,4] print(first) del first[:] print(first) del first print(first) output: [1, 2, 3, 4] [] Traceback (most recent call last): File "main.py", line 6, in <module> print(first) NameError: name 'first' is not defined answer is B
upvoted 3 times
...
Arulkumar
1 year, 7 months ago
Ans : B . del l and subsequent use of variable l will return NameError and and del l1[:] will return empty list
upvoted 1 times
...
macxsz
2 years, 7 months ago
Selected Answer: B
B. yes, there is, the first line deletes the list as a whole, the second line just empties the list
upvoted 3 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 ...