NEW
Font size
S
M
L
XL
WorksheetsPython Pages 10 to 26
Total questions: 15
Worksheet time: 8mins
Name
Class
Date
1.
Which one of the following would show 'hello world' when the code was run?
a)
print("hello world)
b)
Print("hello world")
c)
print("hello world")
d)
print(hello world)
2.
What would print(14//3) show when the code is run?
a)
4
b)
5
c)
2
d)
None of the above
3.
Which of the following sections of code would give the number of seconds in a week?
a)
print(60*60*24*30)
b)
Print(60*60*24*7)
c)
print(60*24*7)
d)
print(60*60*24*7)
4.
What would print(8**3) show on the screen when the code is run?
a)
24
b)
64
c)
512
d)
83
5.
Which of the following snippets of python code would solve the following problem ....?
You are going on holiday to France and need to find out how many Euros you would get when you convert £720 at an exchange rate of £1 = €1.12
You are going on holiday to France and need to find out how many Euros you would get when you convert £720 at an exchange rate of £1 = €1.12
a)
print(720*1.12)
b)
print(720%1.12)
c)
print(720/1.12)
d)
print(1.12/720)
6.
What would the code print(48/12+4) give as an answer if it was run?
a)
16
b)
8
c)
3
d)
None of the above
7.
Variables are used in many different coding languages to store information. Both python and Scratch use variables.
In the example below 'age' is a variable. What would be the result of running the following code?
age=13
print(age)
In the example below 'age' is a variable. What would be the result of running the following code?
age=13
print(age)
a)
the word 'age' would appear on the screen
b)
the number 13 would appear on the screen
8.
A student is trying to write some code to work out how many days she has been alive. She has made a mistake in the third line of her code, which section of code would correct her mistake?
age=13
number_of_days_alive=age*365
print(age)
age=13
number_of_days_alive=age*365
print(age)
a)
print(number_of_days_alive)
b)
print(365)
c)
Print(number_of_days_alive)
d)
print(Age)
9.
What would the following code show on the screen when it is run?
length=15
width=6
area_of_rectangle=length*width
print(area_of_rectangle)
length=15
width=6
area_of_rectangle=length*width
print(area_of_rectangle)
a)
21
b)
2.5
c)
'area of rectangle'
d)
90
10.
What would the following snippet of code show as an answer when run?
print(27%5)
print(27%5)
a)
5
b)
2
c)
1.35
d)
None of the above
11.
True or False? An expression can be assigned to a variable?
a)
True
b)
False
12.
Which of the following is not a valid Python variable names?
a)
4ab
b)
name
c)
school1
d)
age
13.
A student has just learnt how to use the input command. Which of the following would ask for your name and then output it to the screen?
a)
name=input (What is your name?)
print(name)
b)
Input("What is your name?")
print(name)
c)
name=input("What is your name")
print(name)
d)
input("What is your name?")
print(name)
14.
What is the data type in the code snippet shown below?
title="Python for Key Stage 4"
a)
String
b)
Integer
c)
Boolean
d)
Floating Point
15.
Which of the following statements will assign the value 24 to the variable hours_in_a_day ?
a)
24=hours_in_a_day
b)
there are 24 hours in a day
c)
hours_in_a_day=24
d)
Hours_in_a_day=24
Reset
