Test Series - python

Test Number 28/108

Q: What is the default value of encoding in encode()?
A. ascii
B. qwerty
C. utf-8
D. utf-16
Solution: The default value of encoding is utf-8.
Q: What will be the output of the following Python code?

print("xyyzxyzxzxyy".endswith("xyy"))
A. True
B. 0
C. 1
D. 2
Solution: The function returns True if the given string ends with the specified substring.
Q: What will be the output of the following Python code?

print("xyyzxyzxzxyy".endswith("xyy", 0, 2))
A. True
B. 0
C. 1
D. False
Solution: The function returns False if the given string does not end with the specified substring.

You Have Score    /3