1. What will the following code output?
x = 10
print(x) # Print the current value of x
x += 1 # Increment x
# if you wanted to replicate the post increment behavior exactly in python
# you would do the following.
x2 = 10
print(x2)
x2 = x2 + 1
Pyhton Debugging Questions
Quiz
•
Information Technology (IT)
•
University
•
Hard
Srilekha Karthick
Used 5+ times
FREE Resource
25 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
1. What will the following code output?
x = 10
print(x) # Print the current value of x
x += 1 # Increment x
# if you wanted to replicate the post increment behavior exactly in python
# you would do the following.
x2 = 10
print(x2)
x2 = x2 + 1
11
10
Compilation error
Runtime error
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will this code print?
a = 10
b = 0
try:
print(a / b)
except ZeroDivisionError:
print("Error")
Error
Infinity
0
1
3.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the output of this code?
a = 7
b = 3
print(a % b)
2
1
0
3
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output of the following Python program?
try:
x = 5/0 except Zero DivisionError:
print("Error: Division by zero is not allowed.")
5
0
Error: Division by zero is not allowed.
None
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output of the following Python program?
try:
x = [1, 2, 3] print(x[5]) except IndexError:
print("Error: Index out of range.")
1
2
3
Error: Index out of range.
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output of the following Python program?
try: x = "hello" print(x[10]) except IndexError:
print("Error: Index out of range.")
'h'
'o'
Error: Index out of range.
None
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output of the following Python program?
try:
x = 5
y = "hello"
print(x + y)
except TypeError:
print("Error: Invalid data type.")
5hello
hello5
Error: Invalid data type.
None
20 questions
QUIZ#1 MIL GALILEE
Quiz
•
12th Grade - University
20 questions
Algoritma Struktur Data
Quiz
•
University
30 questions
Computer Science
Quiz
•
University
30 questions
Form 4 - CSEC Information Technology Quiz
Quiz
•
10th Grade - University
22 questions
Unit-8 (QB64) Year-6
Quiz
•
6th Grade - University
30 questions
PPL (QUIZ 4) Programming Control Structures
Quiz
•
University
25 questions
Seatwork #4
Quiz
•
12th Grade - University
20 questions
PHP Basics and Forms
Quiz
•
University
15 questions
Multiplication Facts
Quiz
•
4th Grade
20 questions
Math Review - Grade 6
Quiz
•
6th Grade
20 questions
math review
Quiz
•
4th Grade
5 questions
capitalization in sentences
Quiz
•
5th - 8th Grade
10 questions
Juneteenth History and Significance
Interactive video
•
5th - 8th Grade
15 questions
Adding and Subtracting Fractions
Quiz
•
5th Grade
10 questions
R2H Day One Internship Expectation Review Guidelines
Quiz
•
Professional Development
12 questions
Dividing Fractions
Quiz
•
6th Grade