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

Unlimited Access

Get Unlimited Contributor Access to the all ExamTopics Exams!
Take advantage of PDF Files for 1000+ Exams along with community discussions and pass IT Certification Exams Easily.

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: BC 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
deckman
Highly Voted 1 year, 10 months ago
Selected Answer: BD
B and D are correct
upvoted 6 times
...
Jos015
Most Recent 4 months, 3 weeks 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
7 months, 2 weeks ago
string after reverse and just take -1 = string = S string[0] == string [-1] len(string) == 1
upvoted 1 times
...
dicksonpwc
11 months, 1 week 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 ago
B and D are correct answer
upvoted 1 times
...
macxsz
1 year, 11 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 ...