exam questions

Exam PCAP-31-03 All Questions

View all questions & answers for the PCAP-31-03 exam

Exam PCAP-31-03 topic 1 question 85 discussion

Actual exam question from Python Institute's PCAP-31-03
Question #: 85
Topic #: 1
[All PCAP-31-03 Questions]

What is the expected behavior of the following code?

the_list = "1,2 3.split()
the_string = ''.join(the_list)
print(the_string.isdigit())

  • A. it outputs False
  • B. it outputs True
  • C. it outputs nothing
  • D. it raises an exception
Show Suggested Answer Hide Answer
Suggested Answer: D 🗳️

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
jaycosmo_23
6 days, 16 hours ago
Selected Answer: A
>>> the_list = "1,2 3".split() >>> the_string = ''.join(the_list) >>> print(the_string.isdigit()) False
upvoted 1 times
...
flthymcnsty
3 weeks, 4 days ago
Selected Answer: D
Explanation: The code contains a syntax error: "1,2 3.split() is not a valid Python statement. There is a missing closing quote for the string and a misplaced method call (split()). This will raise a SyntaxError at runtime. The correct answer is:

D. it raises an exception
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