Font size
WorksheetsPython Basics Quiz
Total questions: 10
Worksheet time: 5mins
What will the following code output? print("Hello, World!")
Hello
Hello World
Hello, World!
"Hello, World!"
Which of the following is the correct way to write a comment in Python?
// This is a comment
/* This is a comment */
# This is a comment
-- This is a comment
What will be printed? print("3 + 2 =", 3 + 2)
3 + 2 = 3 + 2
3 + 2 = 32
3 + 2 = 5
Error
Which of the following is NOT a correct Python data type?
list
float
string
decimal
What is the result of this code? print("Result:", 5 * "2")
Result: 10
Result: 22222
Result: 2*5
Error
What is the correct way to print the following text including quotes? She said, "Python is fun!"
print('She said, "Python is fun!"')
print("She said, "Python is fun!"")
print(She said, "Python is fun!")
print("She said, \"Python is fun!\"")
What will be displayed? # This is a comment print("Hello")
# Another comment
# This is a comment Hello # Another comment
Hello
This is a comment Hello Another comment
Error
Which code will cause an error?
print(10)
print("10")
print(Hello)
print("Hello")
What is the data type of the variable x? x = 10.0
int
float
double
decimal
What will the following code output?
print("abcdefg") print() print("jklmnop")
abcdefg jklmnop
abcdefg
jklmnop
abcdefg-jklmnop
D. Error
