Deck 6: Functions

ملء الشاشة (f)
exit full mode
سؤال
It is possible for a function to have some parameters with default arguments and some without.
استخدم زر المسافة أو
up arrow
down arrow
لقلب البطاقة.
سؤال
The ________ statement causes a function to end and the flow of control to move back to the point where the function call was made.

A) end
B) break
C) continue
D) return
E) exit
سؤال
Functions are ideal for use in menu-drive programs. When a user selects a menu item, the program can call an appropriate function to carry out the user's choice.
سؤال
When a function just needs to use a copy of an argument passed to it, the argument should normally be passed by value.
سؤال
A ________ variable is defined inside the body of a function and is not accessible outside that function.

A) global
B) reference
C) local
D) counter
E) constant
سؤال
A ________ is a program module whose purpose is to test other modules by calling them.

A) stub
B) driver
C) main function
D) dummy program
E) pseudocode routine
سؤال
A function ________ includes the statements that make up the function.

A) definition
B) prototype
C) call
D) heading
E) parameter
سؤال
In a function call, in addition to the name of the function, you are required to furnish

A) a data type for each argument.
B) an identifier name or constant for each argument.
C) the data type of the return value.
D) All of the above
E) A, and B, but not C.
سؤال
A function with a return type of bool must return a value of either True or false.
سؤال
The value in ________ local variable is retained between function calls.

A) a global
B) an internal
C) a static
D) a dynamic
E) no
سؤال
When used as a parameter, a ________ variable allows a function to access and modify the original argument passed to it.

A) static
B) value
C) reference
D) floating-point
E) default value
سؤال
A function other than the main function is executed

A) when it is first defined.
B) when its function prototype is encountered.
C) only once.
D) when the main function finishes executing.
E) whenever it is called.
سؤال
A void function is one that

A) does nothing useful.
B) has an empty function body.
C) has no parameters.
D) returns no value.
E) returns a zero or null character.
سؤال
Two or more functions may have the same name provided that

A) they do different things.
B) one has a prototype and the other doesn't.
C) their parameter lists are different.
D) their return types are different.
E) either C or D is True.
سؤال
The ________ function causes the entire program to terminate, regardless of which function or control mechanism is executing.

A) terminate()
B) return()
C) continue()
D) exit()
E) break()
سؤال
A function can have zero to many parameters and either zero or one return value(s).
سؤال
In a function prototype, in addition to the name of the function, you are required to furnish

A) a data type for each parameter.
B) an identifier name for each parameter.
C) the data type of the return value.
D) all of the above.
E) A and C, but not B.
سؤال
When more than one function has the same name they are called ________ functions.

A) overloaded
B) renamed
C) parallel
D) identical
E) sister
سؤال
In a function header, in addition to the name of the function, you are required to furnish

A) a data type for each parameter.
B) an identifier name for each parameter.
C) the data type of the return value.
D) all of the above.
E) B and C, but not A.
سؤال
Breaking a program up into a set of manageable sized functions is called ________ programming.

A) functional
B) modular
C) divisible
D) high-level
E) low-level
سؤال
When you make a function call, the order of the arguments you send does not matter as long as the number of arguments matches the number of parameters the function has.
سؤال
Both function headers and function calls must list the data types of all data being passed to the function.
سؤال
When a function needs access to an original argument passed to it, for example in order to change its value, the argument needs to be

A) passed by value.
B) passed into a reference parameter.
C) a static variable.
D) an integer.
E) a constant.
سؤال
A ________ is a dummy function that is called instead of the actual function it represents, to test that the call to and return from the function are working correctly.

A) stub
B) driver
C) test function
D) void function
E) prototype function
سؤال
A(n) ________ is information that is passed to a function, and a(n) ________ is a special variable that receives and holds that information.

A) function call, function header
B) function prototype, function header
C) parameter, argument
D) argument, parameter
E) formal argument, actual argument
سؤال
Although global variables can be useful, it is considered good programming practice to restrict your use of them.
سؤال
An overloaded function is one

A) that calls other functions.
B) that has the same name as another function.
C) that has too many parameters.
D) that attempts to do too much in a single function.
E) that does different things depending on who calls it.
سؤال
When only a copy of an argument is passed to a function, it is said to be passed

A) by copy.
B) by reference.
C) informally.
D) by value.
E) by default value.
سؤال
A function can have ________ parameters, and it can have either zero or one return value(s).

A) zero to many
B) either zero or one
C) either one or two
D) a maximum of ten
E) no
سؤال
A function ________ is a statement that causes a function to execute.

A) prototype
B) header
C) definition
D) call
E) parameter list
سؤال
You may use the exit() function to return the flow of control from a function back to main() regardless of where the function was called from.
سؤال
In the following statement, what is 22.0?
Cout << sqrt(22.0);

A) A memory location.
B) A parameter.
C) An argument.
D) A default value.
E) An lvalue.
سؤال
In C++ global and local numeric variables are initialized to zero by default.
سؤال
A void function is one that

A) has an empty function body.
B) is never called.
C) returns no value.
D) has no parameters.
E) returns a zero.
سؤال
A function ________ eliminates the need to place the function definition before all calls to the function.

A) header
B) prototype
C) argument
D) parameter
E) that is void
سؤال
A(n) ________ argument is one that is automatically passed to a parameter when the argument is left out of the function call.

A) floating-point
B) actual
C) null
D) default
E) static
سؤال
A static local variable is one

A) whose value never changes.
B) whose value is retained between function calls.
C) with the same name as a global variable.
D) whose scope is limited to the function it is defined in.
E) that is reinitialized each time the function it is defined in is called.
سؤال
If a function has no return statement, the flow of control moves to the next function in the file when the closing brace of the function body is reached.
سؤال
A ________ variable is declared outside all functions.

A) local
B) global
C) static
D) counter
E) constant
سؤال
One reason for using functions is to break programs into a set of manageable units, or modules.
فتح الحزمة
قم بالتسجيل لفتح البطاقات في هذه المجموعة!
Unlock Deck
Unlock Deck
1/40
auto play flashcards
العب
simple tutorial
ملء الشاشة (f)
exit full mode
Deck 6: Functions
1
It is possible for a function to have some parameters with default arguments and some without.
True
2
The ________ statement causes a function to end and the flow of control to move back to the point where the function call was made.

A) end
B) break
C) continue
D) return
E) exit
D
3
Functions are ideal for use in menu-drive programs. When a user selects a menu item, the program can call an appropriate function to carry out the user's choice.
True
4
When a function just needs to use a copy of an argument passed to it, the argument should normally be passed by value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
5
A ________ variable is defined inside the body of a function and is not accessible outside that function.

A) global
B) reference
C) local
D) counter
E) constant
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
6
A ________ is a program module whose purpose is to test other modules by calling them.

A) stub
B) driver
C) main function
D) dummy program
E) pseudocode routine
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
7
A function ________ includes the statements that make up the function.

A) definition
B) prototype
C) call
D) heading
E) parameter
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
8
In a function call, in addition to the name of the function, you are required to furnish

A) a data type for each argument.
B) an identifier name or constant for each argument.
C) the data type of the return value.
D) All of the above
E) A, and B, but not C.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
9
A function with a return type of bool must return a value of either True or false.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
10
The value in ________ local variable is retained between function calls.

A) a global
B) an internal
C) a static
D) a dynamic
E) no
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
11
When used as a parameter, a ________ variable allows a function to access and modify the original argument passed to it.

A) static
B) value
C) reference
D) floating-point
E) default value
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
12
A function other than the main function is executed

A) when it is first defined.
B) when its function prototype is encountered.
C) only once.
D) when the main function finishes executing.
E) whenever it is called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
13
A void function is one that

A) does nothing useful.
B) has an empty function body.
C) has no parameters.
D) returns no value.
E) returns a zero or null character.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
14
Two or more functions may have the same name provided that

A) they do different things.
B) one has a prototype and the other doesn't.
C) their parameter lists are different.
D) their return types are different.
E) either C or D is True.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
15
The ________ function causes the entire program to terminate, regardless of which function or control mechanism is executing.

A) terminate()
B) return()
C) continue()
D) exit()
E) break()
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
16
A function can have zero to many parameters and either zero or one return value(s).
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
17
In a function prototype, in addition to the name of the function, you are required to furnish

A) a data type for each parameter.
B) an identifier name for each parameter.
C) the data type of the return value.
D) all of the above.
E) A and C, but not B.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
18
When more than one function has the same name they are called ________ functions.

A) overloaded
B) renamed
C) parallel
D) identical
E) sister
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
19
In a function header, in addition to the name of the function, you are required to furnish

A) a data type for each parameter.
B) an identifier name for each parameter.
C) the data type of the return value.
D) all of the above.
E) B and C, but not A.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
20
Breaking a program up into a set of manageable sized functions is called ________ programming.

A) functional
B) modular
C) divisible
D) high-level
E) low-level
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
21
When you make a function call, the order of the arguments you send does not matter as long as the number of arguments matches the number of parameters the function has.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
22
Both function headers and function calls must list the data types of all data being passed to the function.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
23
When a function needs access to an original argument passed to it, for example in order to change its value, the argument needs to be

A) passed by value.
B) passed into a reference parameter.
C) a static variable.
D) an integer.
E) a constant.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
24
A ________ is a dummy function that is called instead of the actual function it represents, to test that the call to and return from the function are working correctly.

A) stub
B) driver
C) test function
D) void function
E) prototype function
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
25
A(n) ________ is information that is passed to a function, and a(n) ________ is a special variable that receives and holds that information.

A) function call, function header
B) function prototype, function header
C) parameter, argument
D) argument, parameter
E) formal argument, actual argument
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
26
Although global variables can be useful, it is considered good programming practice to restrict your use of them.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
27
An overloaded function is one

A) that calls other functions.
B) that has the same name as another function.
C) that has too many parameters.
D) that attempts to do too much in a single function.
E) that does different things depending on who calls it.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
28
When only a copy of an argument is passed to a function, it is said to be passed

A) by copy.
B) by reference.
C) informally.
D) by value.
E) by default value.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
29
A function can have ________ parameters, and it can have either zero or one return value(s).

A) zero to many
B) either zero or one
C) either one or two
D) a maximum of ten
E) no
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
30
A function ________ is a statement that causes a function to execute.

A) prototype
B) header
C) definition
D) call
E) parameter list
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
31
You may use the exit() function to return the flow of control from a function back to main() regardless of where the function was called from.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
32
In the following statement, what is 22.0?
Cout << sqrt(22.0);

A) A memory location.
B) A parameter.
C) An argument.
D) A default value.
E) An lvalue.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
33
In C++ global and local numeric variables are initialized to zero by default.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
34
A void function is one that

A) has an empty function body.
B) is never called.
C) returns no value.
D) has no parameters.
E) returns a zero.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
35
A function ________ eliminates the need to place the function definition before all calls to the function.

A) header
B) prototype
C) argument
D) parameter
E) that is void
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
36
A(n) ________ argument is one that is automatically passed to a parameter when the argument is left out of the function call.

A) floating-point
B) actual
C) null
D) default
E) static
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
37
A static local variable is one

A) whose value never changes.
B) whose value is retained between function calls.
C) with the same name as a global variable.
D) whose scope is limited to the function it is defined in.
E) that is reinitialized each time the function it is defined in is called.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
38
If a function has no return statement, the flow of control moves to the next function in the file when the closing brace of the function body is reached.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
39
A ________ variable is declared outside all functions.

A) local
B) global
C) static
D) counter
E) constant
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
40
One reason for using functions is to break programs into a set of manageable units, or modules.
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.
فتح الحزمة
k this deck
locked card icon
فتح الحزمة
افتح القفل للوصول البطاقات البالغ عددها 40 في هذه المجموعة.