4. Functions Flashcards

1
Q

algorithm

A

A general process for solving a category of problems.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

argument

A

A value provided to a function when the function is called. This value
is assigned to the corresponding parameter in the function.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

body

A

The sequence of statements inside a function definition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

composition

A

Using an expression as part of a larger expression, or a statement
as part of a larger statement.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

deterministic

A

Pertaining to a program that does the same thing each time it
runs, given the same inputs.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

dot notation

A
The syntax for calling a function in another module by specifying
the module name followed by a dot (period) and the function name.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

flow of execution

A

The order in which statements are executed during a program

run.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

fruitful function

A

A function that returns a value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

function

A

A named sequence of statements that performs some useful operation.
Functions may or may not take arguments and may or may not produce a
result.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

function call

A

A statement that executes a function. It consists of the function
name followed by an argument list.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

function definition

A

A statement that creates a new function, specifying its name,
parameters, and the statements it executes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

function object

A

A value created by a function definition. The name of the function
is a variable that refers to a function object.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

header

A

The first line of a function definition.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

import statement

A
A statement that reads a module file and creates a module
object.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

module object

A

A value created by an import statement that provides access to
the data and code defined in a module.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

parameter

A

A name used inside a function to refer to the value passed as an
argument.

17
Q

pseudorandom

A

Pertaining to a sequence of numbers that appear to be random,
but are generated by a deterministic program.

18
Q

return value

A

The result of a function. If a function call is used as an expression,
the return value is the value of the expression.

19
Q

void function

A

A function that does not return a value.

20
Q

What is the purpose of the “def” keyword in Python?

a) It is slang that means “the following code is really cool”
b) It indicates the start of a function
c) It indicates that the following indented section of code is to be stored for later
d) b and c are both true
e) None of the above

A

c) It indicates that the following indented section of code is to be stored for later

21
Q

What will the following Python program print out?

def fred():
print("Zap")
def jane():
print("ABC")

jane()
fred()
jane()

a) Zap ABC jane fred jane
b) Zap ABC Zap
c) ABC Zap jane
d) ABC Zap ABC
e) Zap Zap Zap

A

d) ABC Zap ABC