Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

U1/L5 JH Kira - Decomposition using Functions Lesson

Total questions: 24

Worksheet time: 12mins

Name
Class
Date
1.

A ________________ is a named block of code that performs a specific task.

a)

function

b)

variable

c)

loop

d)

class

2.

____________________ is the process of breaking a problem or task down into smaller pieces.

a)

Decomposition

b)

Iteration

c)

Abstraction

d)

Automation

3.

When we are creating a function, we use `def`, which stands for _________________?

a)

define

b)

default

c)

defer

d)

delete

4.

In Python, we use ________________ to show which lines of code are in the function.

a)

indentation

b)

brackets

c)

semicolons

d)

parentheses

5.

When we want to use a function we've created, and make it run, we need to ________________ the function.

a)

call

b)

write

c)

define

d)

declare

6.

To call a function, we use the ______________ of the function.

a)

name

b)

type

c)

value

d)

address

7.

5) `turn_right()` and `turn_left()` are ________________ that were written by someone else that we can now make use of to help the platypus.

a)

functions

b)

variables

c)

loops

d)

conditions

8.

A ________________ is a variable that serves as input to a function.

a)

parameter

b)

constant

c)

operator

d)

statement

9.

You can call a function from inside another ________________. For example, Jagriti called 'paint' from inside the function `paint_row`.

a)

function

b)

variable

c)

loop

d)

class

10.

In the definition of the `paint_row` function, the name of the parameter it has is ________________.

a)

color_to_paint

b)

row_number

c)

paint_type

d)

brush_size

11.

In the final version of Jagriti’s code, the first time the function `paint_row` is called, the value of `color_to_paint` is __________.

a)

red

b)

blue

c)

green

d)

yellow

12.

Functions with Parameters 5) Parameters allow functions to do the same task with different ________________.

a)

values

b)

names

c)

types

d)

locations

13.

Fill in the blank: A ______ is a named block of code that performs a specific task.

a)

function

b)

variable

c)

loop

d)

array

14.

Fill in the blank: ______ is the process of breaking a problem or task down into smaller pieces.

a)

Decomposition

b)

Iteration

c)

Abstraction

d)

Compilation

15.

Fill in the blank: When we are creating a function, we use 'def', which stands for ______.

a)

define

b)

default

c)

definite

d)

defer

16.

Fill in the blank: In Python, we use ______ to show which lines of code are in the function.

a)

indentation

b)

brackets

c)

semicolons

d)

parentheses

17.

Fill in the blank: When we want to use a function we've created, and make it run, we need to ______ the function.

a)

call

b)

define

c)

write

d)

declare

18.

Fill in the blank: To call a function, we use the ______ of the function.

a)

name

b)

type

c)

value

d)

address

19.

True or False: 'turn_right()' and 'turn_left()' are functions that were written by someone else that we can now make use of to help the platypus.

a)

True

b)

False

20.

Fill in the blank: A ______ is a variable that serves as input to a function.

a)

parameter

b)

loop

c)

constant

d)

operator

21.

You can call a function from inside another function.

a)

True

b)

False

22.

Fill in the blank: In the definition of the 'paint_row' function, the name of the parameter it has is ______.

a)

color_to_paint

b)

row_number

c)

paint_type

d)

brush_size

23.

Fill in the blank: In the final version of Jagriti's code, the first time the function 'paint_row' is called, the value of 'color_to_paint' is ______.

a)

red

b)

blue

c)

green

d)

yellow

24.

Parameters allow functions to do the same task with different inputs.

a)

True

b)

False