wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

2.2 Programming Techniques

Total questions: 20

Worksheet time: 9mins

Name
Class
Date
1.
Quotation marks around a variable’s identifier imply that it is a:
a)
String
b)
Integer
c)
Character
d)
List
2.
This variable data type can only have True or False values:
a)
Boolean
b)
Integer
c)
True/False
d)
String
3.
The statement A OR B implies that A and B are:
a)
Booleans
b)
Integers
c)
Strings
d)
Constants
4.
Casting refers to:
a)
Converting between variable data types
b)
Boolean algebra
c)
Printing out of the program’s results
d)
Sending values to a function or procedure
5.
The programming keywords ELSE IF or ELIF are best used when our selection needs to work with:
a)
More than two choices
b)
More than three choices
c)
More than one choice
d)
A conditional loop
6.
Identify the error in the pictured line of Python code
num1 * Num2 = total
a)
The variable assigned must be on the left
b)
Multiplication  symbol should be 'x' not '*'
c)
The variable Num2 can't have a capital letter
d)
'total' needs to be casted as an integer
7.
Which of the following lines of Python code will allow a user to input their username as a variable?
a)
user = input("Input your name: ")
b)
username == input("What is your username?")
c)
print("Input your username")
d)
input("Please enter your username") = userID
8.
Which of the following statements are false about variable names:
a)
They must always be in capital letters
b)
They should be descriptive
c)
They should not start with numbers or contain spaces
d)
They point to memory locations
9.
Which of the following is not a valid data type?
a)
Fraction
b)
Float
c)
String
d)
Integer
10.
Which of these lines of Python code will output the third item from a list called 'games'?
a)
print(games[2])
b)
print games(3)
c)
print(games[3])
d)
print (games(2))
11.
Q1: The following is not true about variable names (1-4)
a)
They must be descriptive
b)
They must be in capital letters
c)
They can’t start with numbers or contain spaces
d)
They point to memory locations
12.
Q2: In an assignment operation, this appears on the right hand side (6-9)
a)
Label for a variable that is destination of data
b)
Multiple variables that are destinations for data
c)
Source variables or operations
d)
The assignment operator
13.
Q5: Consider the following expression: a:=b. This means (6-9)
a)
a will always be equal to b
b)
b is being renamed into a
c)
value of memory location a gets copied to memory location b
d)
value of memory location b gets copied to memory location a
14.
Q6: Which of the following is not a valid data type? (1-4)
a)
Real
b)
String
c)
Character
d)
Fraction
15.
Q8: The multiplication table is best displayed using this data type (4-6)
a)
Boolean
b)
Character
c)
Integer
d)
Real
16.
Q9: This variable type can only have True or False values (1-4)
a)
Boolean
b)
Integer
c)
String
d)
Character
17.
Q11: The operator used to find if a number is divisible by another number: (4-6)
a)
Integer division
b)
MOD
c)
Division
d)
Subtraction
18.
Q12: The statement A OR B implies A & B are (4-6)
a)
Integers
b)
Strings
c)
Booleans
d)
Characters
19.
Q15: The following data types are used in selection conditions & while loops (4-6)
a)
Character
b)
Boolean
c)
Integer
d)
String
20.
Q14: The flowchart shape for selection is
a)
Parallelogram
b)
Square
c)
Diamond
d)
Rounded rectangle