wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Print, Input, Subroutines, Selection

Total questions: 22

Worksheet time: 14mins

Name
Class
Date
1.

Which of the following is not a numeric datatype?

a)

Float

b)

Integer

c)

Complex Numbers

d)

Strings

2.

Which datatype does "hello" belong to ?

a)

String

b)

Numeric

c)

Tuple

d)

None of the above

3.

How are the comment lines written in the python language?

a)

#

b)

@

c)

&

d)

*

4.

What does this function do?

input()

a)

Opens the CD tray.

b)

Asks the user to type something in.

c)

Displays the word 'input'.

d)

Exits the program.

5.

What is a variable?

a)

A number such as 25.

b)

Plus, minus, multiply, divide or equals.

c)

An array of text.

d)

A storage location in the program which stores a value.

6.

True or False:

5.0 is an example of the 'float' datatype.

a)

True

b)

False

7.

What is the process of converting one datatype to another called?

a)

Data conversion.

b)

Type Casting.

c)

Type Conversion.

d)

Concatenation.

8.

What is an integer?

a)

A number with a decimal point.

b)

A whole number.

c)

An array of characters.

d)

A single character.

9.

Leo wants to create a subroutine that will roll a dice. Which syntax is correct?

a)

def dice roll ():

b)

def diceroll ()

c)

def diceroll ():

d)

def diceroll []:

10.

What is the difference between a subroutine and a function?

a)

They are the same thing

b)

A subroutine passes values back out to the program, a function does not

c)

A function passes values back out to the program, a subroutine does not

d)

A function can run without being called

11.

What will the output of this program be when it is run?

a)

Nothing

b)

Hello, world

c)

It will generate an error

12.
Which of the following best describes the order in which these lines are processed in Python?
a)
4, 1, 2
b)
4, 2, 1
c)
1, 2, 3, 4
d)
3, 1, 2
13.
How do you correctly call this function
a)
def(1)
b)
x=square( )
c)
defSquare(4)
d)
x=square(5)
14.

What is the purpose of using subroutines in your programming? (3 Marks)

a)

Avoiding repeated sections of code

b)

Making your code shorter and easier to read

c)

Enabling you to split your code into sections

d)

Avoiding making errors in your code

15.

What is the name of the subroutine?

a)

happyBirthday

b)

person

c)

def

16.

What is the name of the parameter?

a)

happyBirthday

b)

person

c)

def

17.

What will this program display?

a)

The sum is 5

The sum is 691255

b)

2, 3

12345, 678910

18.

Which subroutine will return a value back to the program?

a)

Procedure

b)

Function

19.
What is the word (command) used to display numbers and text on the screen?
a)
print
b)
input
c)
output
d)
command
20.
What is a variable?
a)
A box(memory location) where you store values
b)
a type of graphics
c)
Data type
d)
a type of memory
21.

What will be the output?

name = "Dave"

print (name)

a)

Dave

b)

'Dave'

c)

name

d)

(name)

22.
What is Python?
a)
text based programming language
b)
word processor 
c)
spreadsheet
d)
block based programming language