Worksheets2.2 Programming techniques
Total questions: 24
Worksheet time: 12mins
Which of the following is a valid keyword for output? (1-4)
SHOW
DISPLAY
INPUT
Which of the following is not a valid data type? (1-4)
Real
String
Character
Fraction
Quotation marks around a variable’s identifier imply (1-4)
It is an integer
It is a string
It is a Boolean
It is a real
The multiplication table is best displayed using this data type (4-6)
Boolean
Character
Integer
Real
This variable type can only have True or False values (1-4)
Boolean
Integer
String
Character
Casting refers to: (4-6)
Boolean algebra
Rounding of reals
Converting between variable data types
Printing out of the program’s results
The operator used to find if a number is divisible by another number: (4-6)
Integer division
MOD
Division
Subtraction
This function calculates the length of a string (4-6)
UBOUND
INDEX
LEN
COUNT
The main difference between procedures & functions is
Procedures are usually longer & have more instructions
Functions use parameter passing, while procedures don’t
Functions are more difficult to debug
Functions return values, while procedures don’t
The flowchart shape for selection is
Parallelogram
Square
Diamond
Rounded rectangle
5.23 would be stored as:
Integer
Real Number
String
Character
Boolean
ELSE IF keyword is used when
Our selection needs to work with more than three choices
Our selection needs to work with more than two choices
SELECT CASE/SWITCH statement is not available
Using conditional loops
The most appropriate file mode for creating a logbook
Read
Write
Append
Close
What is Python?
A programming language
A binary language
Machine code
What is Python?
A programming language
A binary language
Machine code
What does the keyword "import" mean
Add an additional library to our program
Create a random number
Output a string
Create a subroutine
Which loop requires a condition to be met before running?
WHILE
FOR
AND
IF
What is decomposition?
Breaking a problem down into smaller problems to make it easier to solve
Removing unnecessary details from a problem
Creating a list of steps to help solve a problem
Using an if, elif, else loop in our code
What is the name of the parameter?
say_my_name
my_name
name
def
There are none
What is the name of the sub-routine?
say_my_name
my_name
name
def
What is the name of the list?
my_name
correct
names
item
Which of the following is not a method of opening a file?
f = open("file.txt", a)
f = open("file.txt", r)
f = open("file.txt", w)
f = open("file.txt", p)
What does the code do?
Creates a random number between 1 and 100 and prints to the user
Prints the number 100
Nothing, there is an error
Asks the user to guess a random number
