Python Debugging Quiz Form
Test your Python debugging skills by answering the questions below. Please provide your details and carefully review each question before submitting.
Full Name
*
First Name
Last Name
Email Address
*
example@example.com
Which of the following code snippets will successfully print 'Hello World' in Python?
*
print('Hello World')
echo 'Hello World'
printf('Hello World');
System.out.println('Hello World');
Identify the bug: What is wrong with this code? x = 10 if x = 5: print("x is five")
*
Choose the correct output of the following code: for i in range(3): print(i)
*
0 1 2
1 2 3
0 1 2 3
Error
What is the output of this code? my_list = [1, 2, 3] print(my_list[3])
*
3
IndexError
None
0
Explain why the following code results in an error: def add_numbers(a, b): return a + b result = add_numbers(5)
*
Select the correct way to open a file for reading in Python.
*
open('file.txt', 'r')
open('file.txt', 'w')
open('file.txt', 'rw')
open('file.txt')
What will be printed by this code? try: print(1/0) except ZeroDivisionError: print("Error")
*
Error
ZeroDivisionError
1/0
Nothing
Provide the corrected version of this code: for i in range(5) print(i)
*
Submit Quiz
Should be Empty: