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

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

Assuming that the snippet below has been executed successfully, which of the following expressions evaluate to True? (Choose two.) string = 'SKY'[::-1] string = string[-1]

  • A. string[0] == 'Y'
  • B. string[0] == string [-1]
  • C. string is None
  • D. len(string) == 1
Show Suggested Answer Hide Answer
Suggested Answer: BD 🗳️

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
deckman
Highly Voted 2 years, 6 months ago
Selected Answer: BD
B and D are correct
upvoted 6 times
...
Jos015
Most Recent 1 year ago
Selected Answer: BD
string = 'SKY'[::-1] print (string) string = string[-1] print (string) print (string[0] == 'Y') print (string[0] == string[-1]) print (string is None) print (len(string) == 1)
upvoted 4 times
...
emanuelcar990
1 year, 3 months ago
string after reverse and just take -1 = string = S string[0] == string [-1] len(string) == 1
upvoted 1 times
...
dicksonpwc
1 year, 7 months ago
Ans A, False # string[0] == 'S' =>So string[0] !== 'Y' return false Ans B, False # string[0] == 'Y' => but string[-1] = S, return false Ans C, False # string is None => but string = 'SKY', so return false Ans D, True # len(string) = 1 => so len(string) == 1, so return true Correct answer should be B and D
upvoted 1 times
...
dicksonpwc
1 year, 8 months ago
B and D are correct answer
upvoted 1 times
...
macxsz
2 years, 7 months ago
True: B. string[0] == string [-1] D. len(string) == 1
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 ...