Exam PCAP-31-03 All QuestionsBrowse all questions from this exam
Question 51

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

    Correct Answer: A, B

    The first expression verifies that the length of an empty string concatenated with itself is greater than zero. The concatenation of two empty strings is still an empty string, so the length is zero. However, the expression should be `len(""" """) > 0` to be true, but still, it remains false for the given expression. The second expression checks if the length of a string containing a single quote character is equal to one, which is true since the length of a string with one character is 1. The third expression compares the difference between the ASCII values of 'z' and 'Z' with the ASCII value of '0'. The difference between 'z' and 'Z' is 32, while the ASCII value of '0' is 48, so this is incorrect. The fourth expression checks if the character obtained by incrementing 'a' by one ASCII value is equal to 'B'. According to ASCII, the next character would be 'b' and not 'B'. Hence, only options 'A' and 'B' contain expressions that evaluate to True.

Discussion
kstrOptions: AB

AB correct tested

DKAT2023Options: AB

A and B are corrects, C should be : print(ord("z") - ord("Z") == ord(' ')) , D should be : chr(ord('a')+1)='b'