Certified Associate in Python Programming (PCAP) — Question 42
Which of the following expressions evaluate to True? (Choose two.)
Answer options
- A. ord(ג€Zג€) - ord(ג€zג€) == ord(ג€0ג€)
- B. chr(ord('A') +1) == 'B'
- C. len('\'') == 1
- D. len(ג€ג€ג€ ג€ג€ג€) == 0
Correct answer: B, C
Explanation
The correct answers are B and C. Option B is true because the character following 'A' in the ASCII table is indeed 'B'. Option C is also true since the string containing a single backslash has a length of 1. Options A and D are false, as the calculations in A do not yield the ASCII value of '0', and D checks the length of a string that contains characters, not an empty string.