Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Basic Python

Total questions: 20

Worksheet time: 18mins

Name
Class
Date
1.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
2.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
3.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
4.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
5.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
6.
Which of the following is a correctly-formatted comment?
a)
#Comment
b)
&Comment
c)
""Comment""
d)
!Comment
7.
stores a piece of data, and gives it a specific name
a)
variable
b)
whitespace
c)
interpreter
d)
modulo
8.
a line of text that Python won't try to run as code
a)
comment
b)
modulo
c)
variable
d)
boolean
9.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
10.
a data type than can have one of two values: True or False
a)
boolean
b)
variable
c)
modulo
d)
interpreter
11.
The correct way to write a variable in Python?
a)
my_variable = 10
b)
my variable = 10
c)
my_variable is 10
d)
my_variable: 10
12.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
13.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
14.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
15.
To solve a problem that requires the user to enter 10 numbers would use what type of iteration?
a)
While loop
b)
For loop
c)
Variable
d)
Selection
16.
What is python named after
a)
The snake
b)
Television show called Monty Python
17.
What does the term 'debug' mean?
a)
Identify errors and fix them.
b)
Making a calculation
c)
A set of instructions
d)
Looking at code
18.
What syntax can you use to insert a line break between strings so that they appear over multiple lines?
a)
/
b)
\n
c)
\l
d)
n
19.
Which of these would work as a piece of code?
a)
IF answer == "Yes":
b)
if answer == "Yes"
c)
if answer == "Yes":
d)
if answer = "yes":
20.
What is syntax?
a)
Syntax is the word used to describe an error
b)
Syntax is the rules of the programming language
c)
It is used to read information
d)
It is used to output information