NEW
Font size
S
M
L
XL
WorksheetsYear 8 Python
Total questions: 29
Worksheet time: 15mins
Name
Class
Date
1.
What will the output be from the following code?
print("Hello world!")
print("Hello world!")
a)
SyntaxError
b)
Hello world!
c)
"Hello world!"
d)
print(Hello world!)
2.
What will the output be from the following code?
print(3+4)
print(3+4)
a)
3+4
b)
7
c)
SyntaxError
d)
print(3+4)
3.
print("12"*3)
What would this print?
What would this print?
a)
36
b)
121212
c)
24
d)
12*3
4.
What will the output be from the following code?
print("3+4")
print("3+4")
a)
7
b)
3+4
c)
34
d)
SyntaxError
5.
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
6.
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!)
7.
A data type consisting of numbers, letters and symbols.
a)
String
b)
Integer
c)
Float
d)
Boolean
8.
Which is the most appropriate data type for: "13th December"
a)
Float
b)
Boolean
c)
Integer
d)
String
9.
Which function converts data to an integer
a)
print()
b)
int()
c)
input()
d)
def
10.
Which is the most appropriate data type for: 34.9
a)
Float
b)
Boolean
c)
Integer
d)
String
11.
Which is the most appropriate data type for: 8,405,334
a)
Float
b)
Boolean
c)
Integer
d)
String
12.
x = int(input("Enter a Number"))
print(X)
Why won't this work?
print(X)
Why won't this work?
a)
Brackets are in the wrong place
b)
Print should have a capital letter
c)
It should have two equals
d)
both x variables should be lower case
13.
When would I use '=='?
a)
Checking if two values are equal
b)
Making a value equal to another
c)
Checking if a value is not equal to another value
d)
Check if a value exists or not
14.
Which of these is used for selection?
a)
if
b)
while
c)
for
d)
do
15.
How many elif's can you have in one statement?
a)
1
b)
2
c)
4
d)
infinite
16.
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
17.
If you want more than one option for your code, what do you use (after if)?
a)
elif
b)
else
c)
ifif
18.
What symbol do you use to make a comment in Python?
a)
@
b)
¬
c)
;
d)
#
19.
In python the ' INTEGER data type' can be defined as...?
a)
holds alphanumeric data as text
b)
holds whole numbers
c)
holds numbers with a decimal point
d)
holds either ‘true’ or ‘false’
20.
In python the ' STRING data type' can be defined as...?
a)
holds alphanumeric text
b)
hold whole numbers
c)
holds numbers with a decimal point
d)
holds either a true or false value
21.
In python the ' FLOAT data type' can be defined as...?
a)
holds alphanumerical data
b)
holds whole numbers
c)
holds a decimal point in a number
d)
hold either true or false
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 data type would be used for storing someone's telephone numbers?
a)
Float (using a decimal point)
b)
Integer (just whole numbers)
c)
String (alphanumerical data)
24.
If we needed to store information such as a POSTCODE in PYTHON, what data type would we use?
a)
String (alphanumerical)
b)
Float (decimal point)
c)
Boolean (true or false)
25.
what is correct code for INTEGER in python?
a)
in
b)
ing
c)
int
26.
What best defines an IF statement in python?
a)
Is an embedded string with a variable
b)
An IF statement checks to see if a statement is true or false and then does one of two things depending on the result.
27.
I am 71 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
“You are aged to perfection!”
b)
"Wow, you are half a century old!"
c)
"You are a spring chicken!"
28.
I am 18 years old! What will the output be?: IF you are 70 or older, say “You are aged to perfection!” ELIF you are exactly 50, say “Wow, you are half a century old!” ELSE say “You are a spring chicken!”
a)
"You are aged to perfection"
b)
"Wow, you are half a century old!"
c)
"You are spring chicken!"
29.
Which Python command is used to output information to the screen?
a)
read
b)
output
c)
print
d)
display
Reset
