wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Y9 Python Review

Total questions: 30

Worksheet time: 10mins

Name
Class
Date
1.
What is the correct way to print 'Hello, World!' in Python?
a)
print('Hello, World!')
b)
echo 'Hello, World!'
c)
printf('Hello, World!')
d)
console.log('Hello, World!')
2.
Which of these is a string in Python?
a)
'123'
b)
123
c)
True
d)
None
3.
What does the input() function do?
a)
Prints output
b)
Takes user input
c)
Defines a variable
d)
Ends the program
4.
Which of these is a float?
a)
3.14
b)
'3.14'
c)
3
d)
True
5.
What is the data type of True?
a)
int
b)
str
c)
bool
d)
float
6.
Which symbol is used for comments in Python?
a)
#
b)
//
c)
/* */
d)
<!-- -->
7.
What will print(2 + 3 * 4) output?
a)
20
b)
14
c)
24
d)
9
8.
Which function is used to display output in Python?
a)
print()
b)
input()
c)
output()
d)
display()
9.
What is the result of input('Enter your name: ')?
a)
It prints the name
b)
It stores user input
c)
It exits the program
d)
It adds two numbers
10.
Which of these is a valid variable name?
a)
my_var
b)
2var
c)
my-var
d)
my var
11.
What is the type of 'Hello'?
a)
int
b)
str
c)
bool
d)
float
12.
Which of these is not a data type in Python?
a)
list
b)
tuple
c)
number
d)
dict
13.
What does print('5' + '5') output?
a)
10
b)
55
c)
5 + 5
d)
Error
14.
Which function converts a string to an integer?
a)
int()
b)
str()
c)
float()
d)
bool()
15.
What is the output of print(type(10))?
a)
<class 'int'>
b)
<class 'str'>
c)
<class 'float'>
d)
<class 'bool'>
16.
Which of these is a boolean value?
a)
Yes
b)
No
c)
True
d)
Maybe
17.
What is the output of print(10 // 3)?
a)
3.33
b)
3
c)
4
d)
3
18.
Which of these is used to get user input?
a)
input()
b)
get()
c)
read()
d)
scan()
19.
What is the output of print('Python' * 2)?
a)
PythonPython
b)
Python2
c)
Python Python
d)
Error
20.
Which of these is a float?
a)
7
b)
'7.0'
c)
7
d)
True
21.
What is the output of print(3 ** 2)?
a)
6
b)
9
c)
8
d)
5
22.
Which of these is a string?
a)
'abc'
b)
123
c)
True
d)
3.14
23.
What is the result of print(10 % 3)?
a)
1
b)
3
c)
10
24.
Which of these is not a valid Python keyword?
a)
print
b)
input
c)
output
d)
if
25.
What is the output of print('3' + '4')?
a)
34
b)
7
c)
3 + 4
d)
Error
26.
Which function is used to convert a number to a string?
a)
str()
b)
int()
c)
float()
d)
bool()
27.
What is the output of print(type('True'))?
a)
<class 'str'>
b)
<class 'bool'>
c)
<class 'int'>
d)
<class 'float'>
28.
Which of these is a valid string?
a)
'Hello'
b)
Hello
c)
123
d)
True
29.
What is the output of print(4 / 2)?
a)
2
b)

3

c)
4
30.
Which of these is used to print text?
a)
print()
b)
echo()
c)
say()
d)
write()