WorksheetsChapter 6 Quiz – Part One
Total questions: 26
Worksheet time: 9mins
_____ _______: breaking a program up into smaller, manageable functions or modules. It supports the divide-and-conquer approach to solving a problem.
(a)
(a) : a collection of statements to perform a specific task
Reason for modular programming are..
1) Simplifies the process of writing programs
2) Improves the maintainability of programs
(a)
____ ____: a statement that causes a function to execute
(a)
___ _____: the statements that make up a function
(a)
A function definition includes how many items? (a number)
(a)
_____ ____: the variables that hold the values that are passed to the function when it is called
(a)
(a) : the statements that perform the function’s task
___ ____: data type of the value the function returns to the part of the program that called it
(a)
The function header consists of:
the function return type
the function name
the function parameter list
If a function does not return a value, its return type is (a)
To call a function, use the function name followed by () and _
(a)
When a function is called, the program executes the (a) of the function
After the function terminates, execution resumes in the (a) module at the point of call
(a) is automatically called when the program starts
(a) can call any number of functions
(a) can call other functions
The (a) must know the following about a function before it is called
its name
the return type
the number of parameters
the data type of each parameter
There are multiple ways to notify the compiler about a function before making a call to the function:
Place the function definition before the calling function’s definition
Use a function prototype (similar to the header of the function)
Place (a) near the top of the program
When using prototypes, the function definitions can be placed in any order in the source file. Traditionally, (a) is placed first.
Values passed to a function are (a)
Variables in a function that hold values passed as arguments are (a)
For each function argument,
the prototype must include the data type of each parameter in its (). It may also include a parameter name:
void evenOrOdd(int); or
void evenOrOdd(int num); // prototype
the header must include a declaration, with (a) type and name, for each parameter in its ().
When calling a function with (a) arguments
1) the number of arguments in the call must match the function prototype and definition
2) the value of the first argument will be copied into the first parameter, the value of the second argument into the second parameter, etc.
___ ____ ____: when an argument is passed to a function, a copy of its value is placed in the parameter
(a)
