1. What type of operator is 'not'?
2. Which of the following functions will return a reversed list?
3. How do you write an inline comment in Python?
4. What does the 'break' statement do within a loop?
A. Continues to the next iteration of the loop
B. Executes the body of the loop and then terminates
C. Terminates the current loop and moves back up to the parent loop
D. Terminates the loop immediately*
5. What is the output of this code?
my_list = ["apple", "banana", "cherry"]
for x in my_list:
A. apple banana cherry
B. [apple, banana, cherry]
C. 0, 1, 2*
D. apple, banana, cherry
6. What do you need to do in order to open a file using the open() function?
A. Pass the file name
B. Pass the file name and mode*
C. Pass the path of the file
D. Pass the path and mode of the file
7. What does 'def' do in Python?
B. Creates a function*
C. Creates a statement
D. Terminates the current loop
8. What do you need to use to iterate through a collection of items?
A. A for loop*
B. An if statement
C. An else statement
D. A while loop
9. What type of exception is 'IndexError'?
10. To raise an exception in Python, what type of statement should you use?
A. raise SyntaxError
B. raise Error
C. raise ValueError
D. throw Error*