Here are 5 more Python multiple-choice questions:
1. What is the output of the following code?
x = [1, 2, 3, 4]
print(x[-1])
a) 4
b) 3
c) IndexError
d) None
Answer: a) 4
2. Which of the following is not a valid Python data type?
a) list
b) dictionary
c) tuple
d) array
Answer: d) array
3. How can you get all the keys from a dictionary my_dict?
a) my_dict.keys()
b) keys(my_dict)
c) my_dict.all_keys()
d) my_dict.get_keys()
Answer: a) my_dict.keys()
4. What is the output of the following code?
x = "Hello"
y = "World"
print(x + " " + y)
a) HelloWorld
b) Hello World
c) Hello+World
d) Syntax Error
Answer: b) Hello World
5. Which of the following functions can be used to convert a string to lowercase?
a) toLowerCase()
b) lowercase()
c) tolower()
d) lower()
Answer: d) lower()
Let me know if you need more!