wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Python Chapter 5: Functions

Total questions: 15

Worksheet time: 8mins

Name
Class
Date
1.

A group of statements that exist within a program for the purpose of performing a specific task is a(n)           .

a)

block

b)

parameter

c)

function

d)

expression

2.

A design technique that helps to reduce the duplication of code within a program and is a benefit of using functions is           .

a)

code reuse

b)

divide and conquer

c)

debugging

d)

facilitation of teamwork

3.

The first line of a function definition is known as the           .

a)

body

b)

introduction

c)

initialization

d)

header

4.

You            a function to execute it.

a)

define

b)

call

c)

import

d)

export

5.

A design technique that programmers use to break down an algorithm into functions is known as           .

a)

top-down design

b)

code simplification

c)

code refactoring

d)

hierarchical subtasking

6.

A            is a diagram that gives a visual representation of the relationships between functions in a program.

a)

flowchart

b)

function relationship chart

c)

symbol chart

d)

hierarchy chart

7.

The                 keyword is ignored by the Python interpreter and can be used as a placeholder for code that will be written later.

a)

placeholder

b)

pass

c)

pause

d)

skip

8.

A            is a variable that is created inside a function.

a)

global variable

b)

local variable

c)

hidden variable

d)

none of the above; you cannot create a variable inside a function

9.

A(n)            is the part of a program in which a variable may be accessed.

a)

declaration space

b)

area of visibility

c)

scope

d)

mode

10.

A(n)            is a piece of data that is sent into a function.

a)

argument

b)

parameter

c)

header

d)

packet

11.

A(n)            is a special variable that receives a piece of data when a function is called.

a)

argument

b)

parameter

c)

header

d)

packet

12.

A variable that is visible to every function in a program file is a           .

a)

local variable

b)

universal variable

c)

program-wide variable

d)

global variable

13.

When possible, you should avoid using            variables in a program

a)

local

b)

global

c)

reference

d)

parameter

14.

This is a prewritten function that is built into a programming language.

a)

standard function

b)

library function

c)

custom function

d)

cafeteria function

15.

This standard library function returns a random integer within a specified range of values.

a)

random

b)

randint

c)

random_integer

d)

uniform