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

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

How many stars (*) does the snippet print?

  • A. the code is erroneous
  • B. five
  • C. four
  • D. two
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
seaverick
10 months ago
Selected Answer: A
s='*****' s= s - s[2] #TypeError: unsupported operand type(s) for -: 'str' and 'str' print(s) #For strings, only + ( concatenate ) and * (multiply) is allowed. TypeError will be returned #TypeError: unsupported operand type(s) for -: 'str' and 'str' #Ans: the code is erroneous
upvoted 1 times
...
Arulkumar
1 year, 7 months ago
For strings, only + ( concatenate ) and * (multiply) is allowed. TypeError will be returned Ans: A
upvoted 1 times
...
Suvabrata
2 years, 5 months ago
A is correct. strings support concatenation. '-' is not supported in strings
upvoted 1 times
...
666_m
2 years, 6 months ago
A. the code is erroneous is correct
upvoted 1 times
...
macxsz
2 years, 6 months ago
Selected Answer: A
A. the code is erroneous
upvoted 2 times
...
smarty_arse
2 years, 10 months ago
Selected Answer: A
Correct. TypeError will be thrown
upvoted 3 times
...
Noarmy315
2 years, 11 months ago
-(minus) is not supported b/n 'str' and 'str', if +(plus) then it works, ex. s=s+s[2] then '******' six stars
upvoted 1 times
...
pypaul
4 years ago
A is answers. The snippet wiill generate a TypeError
upvoted 4 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 ...