NEW
Font size
WorksheetsPython Review of Units 3 and 4
Total questions: 31
Worksheet time: 16mins
What is the result of the following expression in Python: `True and False`?
True
False
None
1
Which of the following is a comparison operator in Python?
`+`
`==`
`and`
`#`
Which of the following is a logical operator in Python?
`*`
`or`
`!=`
`//`
What is the result of the expression `7 % 3` in Python?
1
2
3
4
What will be the output of the following code?
x = 3.14159
print(round(x, 2))
3.14
3.15
3.141
3.142
Which of the following is a valid variable name in Python?
1variable
variable_1
variable-1
variable 1
What is the result of the following expression: `not (True or False)`?
True
False
None
0
What does the following Python code do?
# This is a comment
print("Hello, World!")
Prints "This is a comment"
"Hello, World!"
Prints nothing
Causes an error
What is the result of the expression `5 ** 2` in Python?
10
25
7
20
Which of the following is a string operator in Python?
`+`
`*`
`//`
`and`
What will be the output of the following code?
x = 10
y = 5
if x > y:
print("x is greater than y")
else:
print("x is not greater than y")
x is greater than y
x is not greater than y
Error
No output
Which of the following is not a comparison operator in Python?
`<=`
`!=`
`<>`
`==`
What is the result of the following expression: `not False`?
True
False
None
0
What will be the output of the following code?
x = 4
y = 2
print(x // y)
2.0
2
1
0
Which of the following is a valid comment in Python?
`// This is a comment`
`/* This is a comment */`
`# This is a comment`
``
What is the result of the following expression: `10 / 3`?
3
3.33
3.3333333333333335
3.0
What will be the output of the following code?
x = "Hello"
y = "World"
print(x + " " + y)
HelloWorld
Hello World
Hello
World
What is the result of the following expression: `5 >= 5`?
True
False
None
0
What will be the output of the following code?
x = 3.7
print(round(x))
3
4
3.7
Error
Which of the following is a mathematical operator in Python?
`and`
`or`
`+`
`==`
What is the result of the following expression: `not (3 > 5)`?
True
False
None
0
What will be the output of the following code?
x = 10
y = 3
print(x % y)
1
2
3
0
Which of the following is a valid way to declare a variable in Python?
`int x = 5`
`x = 5`
`declare x = 5`
`var x = 5`
What is the result of the following expression: `4 != 4`?
True
False
None
0
What will be the output of the following code?
x = 2
y = 3
print(x ** y)
6
8
9
5
What is the result of the following expression: `not True`?
True
False
None
0
What will be the output of the following code?
x = 5
y = 10
if x < y:
print("x is less than y")
else:
print("x is not less than y")
x is less than y
x is not less than y
Error
No output
What is the result of the following expression: `7 <= 7`?
True
False
None
0
Which of the following is not a logical operator in Python?
`and`
`or`
`not`
`==`
What is the result of the following expression: `8 // 3`?
2.666
2
3
2.0
What will be the output of the following code?
x = "Python"
y = "Programming"
print(x + " " + y)
PythonProgramming
Python Programming
Python
Programming
