Chapter 5 Multiple choice questions Flashcards

1
Q

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

A

A function.

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

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

A

Code reuse.

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

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

a) body
b) introduction
c) initialization
d) header

A

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

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

You ______ a function to execute it.

a) define
b) call
c) import
d) export

A

You call a function to execute it.

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

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

A

Top-down design.

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

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

A

A hierarchy chart.

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

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

A

A local variable.

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

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

A

A variable’s scope.

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

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

a) argument
b) parameter
c) header
d) packet

A

An argument.

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

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

A

A parameter.

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

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

A

A global variable.

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

When possible, you should avoid using ______ variables in a program.

a) local
b) global
c) reference
d) parameter

A

global variables.

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

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

a) standard function
b) library function
c) custom function
d) cafeteria function

A

A library function.

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

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

a) random
b) randint
c) random_integer
d) uniform

A

randint

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

This statement causes a function to end and sends a value back to the part of the program that called the function.

a) end
b) send
c) exit
d) return

A

The return statement.

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

This type of function returns either True or False.

a) Binary
b) true_false
c) Boolean
d) logical

A

A Boolean function.

17
Q

This is a math module function.

a) derivative
b) factor
c) sqrt
d) differentiate

A

sqrt

square root