A Python script stores a service banner with banner = 'SSH-2.0-OpenSSH_8.9'. Which three expressions evaluate to True? (Choose three.)
Choose 3 answers
Show the answer
Correct answersA. 'SSH' + '-2.0' in bannerD. 'OpenSSH' in bannerE. 'SSH-' * 2 == 'SSH-SSH-'
AWhy this is right: + binds tighter than in, so 'SSH-2.0' is built first and is found at the start of the banner.
BWhy not this: * binds tighter than in, so 'SSHSSH' is built first; the banner does not contain it, so the result is False.
CWhy not this: in is case-sensitive, so the lowercase 'openssh' is not found and the result is False.
DWhy this is right: in tests for a substring, and 'OpenSSH' appears in the banner with matching case.
EWhy this is right: The * operator repeats a string, so 'SSH-' * 2 builds 'SSH-SSH-', which equals the right side.
The in operator tests for a substring, * repeats a string, and + joins strings before in is evaluated, so 'SSH-2.0' is searched for. The lowercase 'openssh' is False because in is case-sensitive. 'SSH' * 2 builds 'SSHSSH', which the banner does not contain, so that expression is False too.