NEW
Font size
S
M
L
XL
WorksheetsPython
Total questions: 52
Worksheet time: 49mins
Name
Class
Date
1.
The character that must be at the end of the line for if, while and for loops .
a)
:
b)
;
c)
.
d)
,
2.
Converts a number to a string
a)
str()
b)
int()
c)
parseInt()
d)
convert
3.
What is python named after
a)
The snake
b)
Television show called Monty Python
4.
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
5.
What extension must you add to the end of a file when saving?
a)
.xlsx
b)
.pptx
c)
.docx
d)
.py
6.
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
7.
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
8.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
9.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
10.
Data type for a whole number
a)
String
b)
Integer
c)
Boolean
d)
Float
11.
A location in memory used to store data that can be changed.
a)
Constant
b)
Value
c)
Variable
d)
Iteration
12.
What is a variable?
a)
A type of graphic
b)
A type of sound
c)
A space in the memory marked for use
d)
Used to remove things from memory
13.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
14.
What function is used to let the user answer a question?
a)
Open
b)
Print
c)
Answer
d)
Input
15.
What is python?
a)
a programming language
b)
DTP software
c)
Spreadsheet software
d)
Computer
16.
How do you display text?
a)
input
b)
output
c)
print
d)
variable
17.
Why do we comment code
a)
To explain what the code does
b)
To show how clever we are
c)
For fun
d)
No reason
18.
What does the following code do?
name = input("what is your name")
a)
says hello
b)
asks for the users DOB
c)
Asks for the users name and stores it in the variable called ,name
d)
Checks information
19.
What is a a variable?
a)
A condition
b)
Display text
c)
A program
d)
A location to store data
20.
What is the name of the programming language we are learning?
a)
Scratch
b)
Python
c)
Pie thin
d)
Scribble
21.
What will be the output?
name = 'Dave'
print (name)
name = 'Dave'
print (name)
a)
Dave
b)
'Dave'
c)
name
d)
(name)
22.
What is the correct definition for a VARIABLE?
a)
a changeable value, such as a score in a computer game.
b)
a value that cannot be changed
23.
what is the code for a STRING in python?
a)
str
b)
stri
c)
stg
24.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
25.
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
26.
How do you display text?
a)
input
b)
output
c)
print
d)
variable
27.
Repeating section of code to simplify a solution
a)
Code
b)
Loops
c)
Program
d)
Bugs
28.
To repeat a fixed number of times use a
a)
while loop
b)
for loop
c)
if loop
d)
indentation
29.
To repeat until a particular condition is true use
a)
while loop
b)
for loop
c)
if loop
d)
indentation
30.
Code executed based on a condition being true
a)
Sequence
b)
Selection
c)
Iteration
d)
Variable
31.
What will the output be from the following code?
print(Hello world!)
print(Hello world!)
a)
Hello world!
b)
SyntaxError
c)
Hello world
d)
print(Hello world!)
32.
What will the output be from the following code?
print("3+4")
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
33.
What will the output be from the following code?
print(3*4)
print(3*4)
a)
34
b)
7
c)
12
d)
3*4
34.
What will the output be from the following code?
print("3*4+5")
print("3*4+5")
a)
SyntaxErrror
b)
17
c)
3*4+5
d)
12
35.
What will the output be from the following code?
print("Hello" + "world" + "today")
print("Hello" + "world" + "today")
a)
Helloworldtoday
b)
Hello world today
c)
"Hello" "world" "today"
d)
SyntaxError
36.
What symbol is used in python to assign values to a variable?
a)
equals =
b)
plus +
c)
forward slash /
d)
asterisk *
37.
Python is an example of a....
a)
Text-based programming language
b)
Object orientated programming language
c)
language written in java script
d)
Visual-based programming language
38.
What does an IF statement do?
a)
Closes the program
b)
Makes a decision
c)
Asks a question
39.
What function is used to let the user answer a question?
a)
Open
b)
Print
c)
Answer
d)
Input
40.
How do you display text?
a)
input
b)
output
c)
print
d)
variable
41.
How do you program an input from the user?
a)
print
b)
variable = input()
c)
if
d)
else
42.
What will the following code do?
name = "Bob"
If (name == "Bob"):
print ("Hello" + name")
else:
print ("I dont know you")
name = "Bob"
If (name == "Bob"):
print ("Hello" + name")
else:
print ("I dont know you")
a)
nothing
b)
display bob
c)
display I do not know you
d)
display BOB
43.
Which Python statement will check to see if a is greater than b?
a)
if a > b:
b)
if (a > b)
c)
if a is greater than b
d)
if a >= b:
44.
Which statement will check to see if a is equal to b?
a)
if a == b
b)
if a = b:
c)
if a != b:
d)
if a == b:
45.
Which statement will check to see if a is less than b and less than c?
a)
if a < b < c:
b)
if a < b and a < c:
c)
if a < b and c:
d)
if a < b and b < c
46.
The correct way to write a variable in Python?
a)
myVariable = 10
b)
my Variable = 10
c)
myVariable is 10
d)
myVariable: 10
47.
Look at this code, how many times will it loop?
a)
50
b)
90
c)
0
d)
4
48.
Look at this code, what shape will it make?
a)
Square
b)
Triangle
c)
Rectangle
d)
Hexagon
49.
Look at this code, what is the variable?
a)
0
b)
4
c)
for
d)
i
50.
What does the decision symbol do?
a)
represents a step in your process
b)
indicates the starting of a process.
c)
indicates a decision needs to be made. There can be multiple outcomes, but often there are just two - yes and no
d)
indicates the ending points of a process
51.
What type of loop is being used?
a)
for
b)
while
c)
if
52.
If the user types Madrid into the programme as his/her answer. What will be the outcome?
a)
Paris
b)
Madrid
c)
Correct
d)
Wrong
Reset
