wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Y10 - Subprograms, Procedures, Functions

Total questions: 19

Worksheet time: 10mins

Name
Class
Date
1.

Definition of a subprogram

a)

A sequence of instructions to perform a specific task with an identifiable name

b)

Breaking down a problem into smaller more manageable chunks

c)

Allows values to be passed into a function

2.

Definition of a Function

a)

A subprogram that executes a block of code when called. It does not return a value

b)

A subprogram that returns a value

c)

Used in a subprogram to allow values to be passed into them

3.

Definition of a Procedure

a)

The values held in the brackets of a subprogram call.

b)

A subprogram that returns a value

c)

A subprogram that executes a block of code when called. It does not return a value

4.

Definition of a Parameter

a)

Used when defining a subprogram to allow values to be passed into them

b)

A sequence of instructions to perform a specific task with an identifiable name

c)

The values held in the brackets of a program call.

5.

Definition of an Argument

a)

A subprogram that returns a value

b)

Used when defining a subprogram to allow values to be passed into it

c)

The values held in the brackets of a subprogram call

6.

Definition of a return value

a)

A value that is returned by a procedure

b)

A value that is returned by a function

c)

Used in a subprogram to allow values to be passed into them

7.

Definition of Decomposition from Computational Thinking

a)

Breaking down a problem into smaller subproblems to make the more manageable

b)

Returning a return value from a function

c)

Creating step by step instructions to perform a task or solve a problem

8.

Subprograms are defined outside of the main program

a)

True

b)

False

9.

Subprograms are defined below the main program

a)

True

b)

False

10.

Is this a function or a procedure?

a)

Function

b)

Procedure

11.

Is this a Function or a Procedure?

a)

Function

b)

Procedure

12.

What is the difference between a Function and a Procedure?

a)

A procedure returns a value whereas a function does not.

b)

A function returns a value whereas a procedure does not

c)

A function accepts parameters whereas a procedure only accepts arguments

13.

Select the THREE facts about subprograms

a)

Subprograms are called from the main program

b)

Subprograms always return a value

c)

When defining subprograms, values passed in are called parameters

d)

When calling subprograms, values passed in are called arguments

e)

Subprograms cannot be called from the main program

14.

Which is the definition of an array

a)

An array can only store a single value of a pre-defined data type

b)

An array is a collection of elements that are all the same data type

c)

An array is a collection of elements that can be a combination of data types

15.

Give the name of the data structure that Python uses to implement arrays?

a)

Variable

b)

Array

c)

List

16.

Which is the correctly written code to store a return value from the subprogram 'YourName' into the variable 'name'

a)

name = YourName

b)

name = YourName()

c)

YourName() = name

17.

How do you initialise an empty list named 'shopping'?

a)

shopping = { }

b)

shopping = " "

c)

shopping = [ ]

18.

How do you initialise an empty string named 'item'?

a)

item = " "

b)

item = { }

c)

item = [ ]

19.

Correct way to use randint to create a random number between 1 and 6?

a)

math.randint(1 to 6)

b)

random.randint(1,6)

c)

random.randint(1,2,3,4,5,6)