WorksheetsPython - Variables
Total questions: 31
Worksheet time: 18mins
What type of data is the following?: X = "295.47"
String
Float
Boolean
integer
What type of variable is the following?: Y = False
Float
String
Integer
Boolean
The process of giving a value to a variable is ...
Allocation
Assignment
Comparison
Debugging
Choose valid variable names from the list of options given below:
1st_name
Last_name
first Name
f1_name
firstName
Num = 90
Num = 20
print(Num)
90
4.5
20
1800
In the following code, what type of variable is being created?
foo = "bar"
Integer
Float
String
Which name would be meaningful in keeping a record of someone's high score?
s
hs
score
highScore
Which of the below are acceptable variable names?
result final = 5
result-final = 1
resultFinal = 3
result#final = 4
Which is the python logo?
Top left
Bottom left
Top right
Bottom right
What do we use variables for?
To store data
Print data
Produce functions
What does int() represent?
internet
integer
intel
input
Choose what / performs.
multiply
add
subtract
divide
What would be printed to the screen for print(z)?
Orange
Banana
Cherry
Hello World!
Why would I get a syntax error?
Line 1 doesn't make sense
Line 2 needs to be indented
No need for quotation marks on line 2
No such thing as an if statement
What will be printed to the screen?
5
10
5 + 10
15
What will be printed to the screen?
5 + John
Syntax error - you cannot add str and int together
John
JohnJohnJohnJohnJohn
What will it print
Error
15
'15'
5
Error
10
'10'
What is the name of the variable in this program?
colour
input
" "
What will be the output of
print (a + b)
12
3
1 + 2
"a + b"
What will be the output of
print (c + d)
34
7
3 + 4
"3 + 4"
What will be the output of
print (a x b)
12
1
2
"1x2"
What will be the output of
print (b x "d")
b x "d"
dd
2 x 4
8
What will be the output of
print (a x "c")
c
"1c"
"c"
1 x "c"
What will be the output of
print (a x d)
"axd"
"1x4"
"4"
4
To display the following on screen Hello World! the following command should be used:
print(Hello World!)
print("Hello World" + !)
print("Hello World!")
print"(Hello World!)"
Which of the following is a correct variable name?
Act11
11myvar
quiz2$
my-var
Which of the following is a wrong variable name?
act2
myvar
quiz 3
Grade11A
Which of the following is a wrong variable name?
@ct2
age11
_age
first_name
Which of the following is a correct variable name?
11A
Grade11#
Com11
my var
