Font size
WorksheetsPrint, Input, Subroutines, Selection
Total questions: 22
Worksheet time: 14mins
Which of the following is not a numeric datatype?
Float
Integer
Complex Numbers
Strings
Which datatype does "hello" belong to ?
String
Numeric
Tuple
None of the above
How are the comment lines written in the python language?
#
@
&
*
What does this function do?
input()
Opens the CD tray.
Asks the user to type something in.
Displays the word 'input'.
Exits the program.
What is a variable?
A number such as 25.
Plus, minus, multiply, divide or equals.
An array of text.
A storage location in the program which stores a value.
True or False:
5.0 is an example of the 'float' datatype.
True
False
What is the process of converting one datatype to another called?
Data conversion.
Type Casting.
Type Conversion.
Concatenation.
What is an integer?
A number with a decimal point.
A whole number.
An array of characters.
A single character.
Leo wants to create a subroutine that will roll a dice. Which syntax is correct?
def dice roll ():
def diceroll ()
def diceroll ():
def diceroll []:
What is the difference between a subroutine and a function?
They are the same thing
A subroutine passes values back out to the program, a function does not
A function passes values back out to the program, a subroutine does not
A function can run without being called
What will the output of this program be when it is run?
Nothing
Hello, world
It will generate an error
What is the purpose of using subroutines in your programming? (3 Marks)
Avoiding repeated sections of code
Making your code shorter and easier to read
Enabling you to split your code into sections
Avoiding making errors in your code
What is the name of the subroutine?
happyBirthday
person
def
What is the name of the parameter?
happyBirthday
person
def
What will this program display?
The sum is 5
The sum is 691255
2, 3
12345, 678910
Which subroutine will return a value back to the program?
Procedure
Function
What will be the output?
name = "Dave"
print (name)
Dave
'Dave'
name
(name)
