Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

8525 GCSE CS 3.2.10 Structured programming and subroutines

Total questions: 19

Worksheet time: 10mins

Name
Class
Date
1.

Using "meaningful identifiers" means...

a)

Giving variables and subroutines sensible names

b)

Giving variables the correct data type

c)

Correct use of conditions in loops

2.

What is the term for a named block of code that can be executed by writing its name.

a)

Subroutine

b)

Condition

c)

Selection

3.

Some subroutines produce a result that is sent back to where they were called from. What is this value called?

a)

Return value

b)

Final value

c)

Parameter

d)

Variable

4.

Local variables...


(choose two answers)

a)

...only exist while their subroutine is executing

b)

...are only accessible in the subroutine in which they are declared

c)

...can only be of the 'integer' data type

d)

...can be used from anywhere in a program

5.

Which of the following is not an example of a subroutine?

a)

Procedure

b)

Function

c)

List

6.

Subroutines are designed to save the programmer time

a)

True

b)

False

7.

Which subroutine will return a value back to the program?

a)

Procedure

b)

Function

8.

Which subroutine will not return a value back to the program?

a)

Procedure

b)

Function

9.

What are the parameters within this procedure?

a)

first name and second name

b)

first and surname

c)

first and second name

d)

myname, first and surname

10.

Which of the following is an advantage of using local variables?

a)

They allow the variable to be used throughout the whole program

b)

They allow variable identifiers to be reused each time

c)

They are easier to program than global variables

d)

A wider range of data types can be used

11.

What term is used to describe data passed into/out of a program?

a)

Variable

b)

Loop

c)

Constant

d)

Parameter

12.

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 []:

13.

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

14.

Which of the following statements is not true?

a)

Functions/subroutines are examples of reusable code

b)

Functions and subroutines are always appropriate in programs

c)

Using functions/subroutines make it easier to "deconstruct" a problem into smaller pieces

d)

They can make programs easier to read and understand

15.

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.

16.

What is the name of the subroutine?

a)

happyBirthday

b)

person

c)

def

17.

What is the name of the parameter?

a)

happyBirthday

b)

person

c)

def

18.

A variable declared within a subroutine

a)

Global

b)

Local

19.

A variable declared in the main program

a)

Global

b)

Local