CSCI 240 Exam 2 Questions with Verified
Correct Answers
match the function header in number, order and data type
A function calling statement must supply arguments that ______.
function name, return type, argument types and argument names
Which of the following appear in a function header?
by executing a return statement with the answer
How does a function report its answer back to its calling (or boss) function?
include argument names
A function prototype does not have to _______.
they already have values provided by the calling function and are ready to be used
When the body of a function begins to execute what is true of its arguments?
False
A variable called score is declared in main(). main() calls a function UpdateScore to update
the score. UpdateScore also has a variable called score. When a value is added to score in
UpdateScore, the value of score in main() is also changed. T or F?
True
Prototype Statements are placed before int main(). T or F?
False
The function header and the calling statement must contain the name and the date type of the
arguments. T or F?
, True
The statement int main() means that main is a function that takes no arguments, and returns
an integer. T or F?
29
What is the subscript of the last element in the array table if it is defined as follows
float Table[30];
for (i = 0, i <25; i++)
cout << ar[i] << " ";
What C++ code will print the contents of an array called ar that has been defined to hold 25
integer values and has been initialized with 25 integer values?
False
The following is a valid array definition T or F?
int ar[];
2 4 6 9 10
What will be displayed with the following code?
int main()
{
int num[5] = {2, 4, 6, 8, 10};
int i;
Correct Answers
match the function header in number, order and data type
A function calling statement must supply arguments that ______.
function name, return type, argument types and argument names
Which of the following appear in a function header?
by executing a return statement with the answer
How does a function report its answer back to its calling (or boss) function?
include argument names
A function prototype does not have to _______.
they already have values provided by the calling function and are ready to be used
When the body of a function begins to execute what is true of its arguments?
False
A variable called score is declared in main(). main() calls a function UpdateScore to update
the score. UpdateScore also has a variable called score. When a value is added to score in
UpdateScore, the value of score in main() is also changed. T or F?
True
Prototype Statements are placed before int main(). T or F?
False
The function header and the calling statement must contain the name and the date type of the
arguments. T or F?
, True
The statement int main() means that main is a function that takes no arguments, and returns
an integer. T or F?
29
What is the subscript of the last element in the array table if it is defined as follows
float Table[30];
for (i = 0, i <25; i++)
cout << ar[i] << " ";
What C++ code will print the contents of an array called ar that has been defined to hold 25
integer values and has been initialized with 25 integer values?
False
The following is a valid array definition T or F?
int ar[];
2 4 6 9 10
What will be displayed with the following code?
int main()
{
int num[5] = {2, 4, 6, 8, 10};
int i;