Chapter 5 Flashcards

(34 cards)

1
Q

Function

A

A group of statements withing a program that perform as specific task.

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

What is a nickname for a function?

A

Divide and conquer

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

Modularized Program

A

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
4
Q

What are the benefits of using a function?

A

Simpler code, code reuse, better testing and debugging, faster development, easier facilitation of teamwork.

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

Void Function

A

Simply executes the statements it contains and then terminates.

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

Value-returning Function

A

Executes the statements it contains, and then it returns a value back to the statements that called it.

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

How are functions named?

A

They have the same rules as variables.

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

Function Definition

A

Specifies what the function does.

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

Function Header

A

First line of function

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
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
11
Q

Main Function

A

A function that is called when the program starts. (Has all the other functions/code in it)

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

Top-Down Design

A

Technique for breaking algorithm into functions.

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

Hierarchy Chart

A

Depicts relationship between functions.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
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
15
Q

Scope

A

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

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

Argument

A

Is any piece of data that is sent into a function.

17
Q

Parameter Variable

A

Variable that is assigned the value of an argument when the function is called.

18
Q

Scope of Parameter

A

The function in which the parameter is used.

19
Q

Global Variable

A

Created by assignment statements written outside all of the functions.

20
Q

Global Constant

A

Global name that references a value that cannot be changed.

21
Q

Void Function

A

Group of statements within a program for performing a specific task.

22
Q

Value-returning Function

A

Group of statements within a program for performing a certain task that returns a value.

23
Q

Boolean Function

A

Returns wither True or False.

24
Q

Standard Library

A

Library of pre-written functions that comes with Python.

25
Modules
Files that store functions of the standard library.
26
random Module
Includes library functions for working with random numbers.
27
Dot Notation
Notation for calling a function belonging to a module.
28
randint Function
Generates a random number in the range provided by the arguments.
29
randrange Function
Similar to range function, but returns randomly selected integer from the resulting sequence.
30
random Function
Returns a random float in the range 0.0 and 1.0.
31
Uniform Function
Returns a random float but allows user to specify range.
32
Seed Value
Initializes the formula that generates random numbers.
33
math Module
Part of a standard library that contain functions that are useful for performing mathematical calculations.
34
Modularization
Grouping related functions in modules.