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

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

Which of the following expressions evaluate to True? (Choose two.)

  • A. str(1-1) in '123456789'[:2]
  • B. 'dcb' not in 'abcde'[::-1]
  • C. 'phd' in 'aplpha'
  • D. 'True' not in 'False'
Show Suggested Answer Hide Answer
Suggested Answer: AD 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
aferiver
Highly Voted 1 year ago
Selected Answer: AD
Correct text is: A. str(1-1) in '0123456789' B. 'dcb' not in 'abcde'[::-1] C. 'phd' in 'alpha' D. 'True' not in 'False' A. str(1-1) in ‘0123456789’ evaluates to True because str(1-1) is ‘0’ which is in ‘0123456789’. B. ‘dcb’ not in ‘abcde’[::-1] evaluates to False because ‘dcb’ is in the reversed string ‘edcba’. C. ‘phd’ in ‘alpha’ evaluates to False because there is no substring ‘phd’ in the string ‘alpha’. D. ‘True’ not in ‘False’ evaluates to True because the string ‘True’ is not a substring of the string ‘False’.
upvoted 8 times
swatiphadtare
11 months, 2 weeks ago
@aferiver - did you give exam recently? how many new questions?
upvoted 1 times
...
...
Jnanada
Highly Voted 1 year, 8 months ago
Only D is correct
upvoted 6 times
...
Damon54
Most Recent 2 months, 1 week ago
There is something wrong with the choices print (str(1-1) in '123456789'[:2]) print ('dcb' not in 'abcde'[::-1]) print ('phd' in 'aplpha') print ('True' not in 'False') False False False True
upvoted 1 times
...
Damon54
2 months, 1 week ago
print (str(1-1) in '123456789'[:2]) False
upvoted 1 times
...
zantrz
2 months, 2 weeks ago
Selected Answer: AD
str(1-1) in '0123456789'
upvoted 1 times
...
stuartz
1 year, 10 months ago
Did the options change from: A. str(1-1) in '123456789'[:2] '0' in '12' is False B. 'dcb' not in 'abcde'[::-1] 'dcv not in 'edcba' is False C. 'phd' in 'aplpha' definitely False D. 'True' not in 'False' Only D is True
upvoted 3 times
stuartz
1 year, 10 months ago
edit: 'dcb' not in 'edcba' is False
upvoted 1 times
...
...
carpmatias
1 year, 11 months ago
Selected Answer: BD
Definetely B and D: >>> 'dcb' not in 'abcde[1-::]' True >>> 'True' not in 'False' True
upvoted 2 times
...
macxsz
1 year, 11 months ago
Selected Answer: D
As it is, only True is: D. 'True' not in 'False'
upvoted 2 times
...
rocky48
2 years, 1 month ago
Selected Answer: BD
str(1-1) in [2:]"123456789" File "<stdin>", line 1 str(1-1) in [2:]"123456789" ^ SyntaxError: invalid syntax >>> 'dcb' not in 'abcde[1-::]' True >>> 'phd' in 'aplpha' False >>> 'True' not in 'False' True So its BD
upvoted 1 times
zantrz
2 months, 2 weeks ago
before providing any answer, please place the code into any IDE. In Pycharm: print("dcb" not in "abcde"[::-1]) returns False. To clarify, in the expression "dcb" not in "abcde"[::-1], the substring 'dcb' is indeed present in the reversed string 'edcba'. Therefore, the correct evaluation is False, not True.
upvoted 1 times
...
...
Noarmy315
2 years, 3 months ago
AD is correct
upvoted 1 times
...
mazimir
2 years, 6 months ago
Exception True False True
upvoted 4 times
techdawgs
2 years, 4 months ago
It also comes down to what is supposed to be the correct text. I have come across this question elsewhere with the below answers which would mean A & D were correct. A. str(1-1) in '0123456789' B. 'dcb' not in 'abcde'[::-1] C. 'phd' in 'alpha' D. 'True' not in 'False'
upvoted 5 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 ...