Chapter 5, Part 1 Flashcards

1
Q

Function

A

Group of statements within a program that perform a specific task.

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

Modularized program

A

Program wherein each task within the program is in its own function

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

Void function

A

Executes the statements it contains and then terminates

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

Value-returning function

A

Executes the statement it contains and then returns a value back to the statement that called it. The input(), float() and int() functions are examples of vale-returning functions.

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

Function definition

A

Specifies what the function does

def function_name() :
statement
statement

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

Function header

A

The first line of the function. Includes def and function_name, followed by parentheses and colon

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

Block

A

Set of statements that belong together as a group

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

Main function

A

Function called when the program starts

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

Top-down design

A

Technique for breaking down algorithms into functions.

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

Hierarchy chart

A

Depicts relationships between functions.

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

Local variable

A

Variable that is assigned a value inside a function.

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

Scope

A

The part of a program in which the variable may be accessed.

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

Argument

A

Piece of data that is sent into a function

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

Parameter variable

A

Variable that is assigned the value of the argument when the function is called. Or, a parameter is a variable that receives an argument that is passed into a function.

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

Scope of parameter

A

The function in which the parameter is used.

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

Global variable

A

Created by assignment statement written outside all of the functions.

17
Q

Global constant

A

Global name that references a value that cannot be changed.

18
Q

Lifetime

A

For how long the variable is “alive”. For a local variable, that is for one execution of the function. For a global variable, that is for as long as the program is running.