wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Program Development - Python: General

Total questions: 25

Worksheet time: 26mins

Name
Class
Date
1.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
2.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
3.
The second part of if, that is executed when the condition is false
a)
if
b)
else
c)
for
d)
input
4.
Data type that can only be true or false
a)
int
b)
string
c)
bool
d)
float
5.
A variable that can hold a collection of values, often called an array in other programming languages
a)
list
b)
int
c)
string
d)
constant
6.
The character that must be at the end of the line for if, while, for etc.
a)
:
b)
;
c)
.
d)
,
7.
Decides if a string only contains numbers
a)
isalpha()
b)
isnumeric()
c)
int()
d)
string()
8.
Tells the interpreter that the code which follows is a function
a)
const
b)
int
c)
def
d)
while
9.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
10.
Python identifies blocks of code by
a)
BEGIN and END keywords
b)
{ and }
c)
aligning up the starts of lines (indentation)
d)
guessing
11.
What is the name of the environment in Python that write your programs and then test them out?
a)
Shell
b)
Window
c)
IDLE
d)
CLI
12.
What is python named after
a)
The snake
b)
Television show called Monty Python
13.
What button do you press to compile (run) your program so that it runs in the shell?
a)
F3
b)
F5
c)
F7
d)
F9
14.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
15.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
16.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
17.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
18.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
19.
What function is used to let the user answer a question?
a)
Open
b)
Print
c)
Answer
d)
Input
20.
How do you display text?
a)
input
b)
output
c)
print
d)
variable 
21.
What will be the output?
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
22.
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
23.
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
24.
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":
25.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif