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’.
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
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
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
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.
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
...
...
This section is not available anymore. Please use the main Exam Page.PCAP Exam Questions
Log in to ExamTopics
Sign in:
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.
aferiver
Highly Voted 2 years agoswatiphadtare
1 year, 11 months agoJnanada
Highly Voted 2 years, 8 months agoDave304409
Most Recent 4 days, 2 hours agoDamon54
1 year, 2 months agoDamon54
1 year, 2 months agozantrz
1 year, 2 months agostuartz
2 years, 10 months agostuartz
2 years, 10 months agocarpmatias
2 years, 11 months agomacxsz
2 years, 11 months agorocky48
3 years, 1 month agozantrz
1 year, 2 months agoNoarmy315
3 years, 3 months agomazimir
3 years, 6 months agotechdawgs
3 years, 4 months ago