1. (TCO 5) A return statement causes execution of a function to (Points : 5) ret
ID: 3645946 • Letter: 1
Question
1. (TCO 5) A return statement causes execution of a function to (Points : 5)return to the top of the loop.
return to the top of main.
return to the top of the function.
terminate and return to where the function was called.
2. (TCO 5) Which of the following statements call the following function correctly?
int MultiplyValues ( int, int );
(Points : 5)
int a = MultiplyValues( int x, int y );
int a = MultiplyValues( 10, 20 );
int d = MultiplyValues( int 10, int 20 );
All of the above
3.
(TCO 5) The code below is an example of what type of function?
int abs(int num)
{
if (num == 0)
num = -num;
return num;
}
(Points : 5)
Value-returning
Void
Subroutine
None of the above
4. (TCO 6) What is the range of valid subscripts for the following array?
double list[10];
(Points : 5)
0 to 9
0 to 10
1 to 9
1 to 10
5. (TCO 6) Given the following array declaration, if the array is stored starting at address 5000, what is the output of the following statement? Assume the code is for a 32 bit processor such as a Pentium.
int data[25] = {0};
cout << &data[20] << endl;
(Points : 5)
0.0
5020
5080
unknown
6. (TCO 6) What does the following function do?
double calc ( double data[ ], int size )
{
double s = 1;
for(int i = 0; i < size; i++)
{
s *= data[i];
}
return(s);
}
(Points : 5)
Returns the product of all the values in the data array
Does nothing because the data array does not exist
Fails because the size of the array is not known
Returns the sum of the values in the data array
7. (TCO 6) foo contains _______.
double foo[500] = {0.0};
(Points : 5)
500 double values
499 double values
one double value of 0.0
None of the above
8. (TCO 6) For the array declared below, what is the sum of list[2] and list[3]?
int list[]= {1,2,3,4,5};
(Points : 5)
5
9
3
7
9. (TCO 5) A ______ identifier is declared within a function. A ______ identifier is declared outside of every function definition. (Points : 5)
local; global
global; local
local; static
static; global
10. (TCO 7) A C-Style string is an array of _______. (Points : 5)
floats
integers
characters
doubles
11. (TCO 7) Which of the following functions would correctly copy C string s2 to C string s1? (Points : 5)
strcpy(s2, s1) ;
strcmp(s1, s2) ;
strcpy(s1, s2) ;
stringcopy(s2, s1) ;
Explanation / Answer
1) terminate and return to where the function was called. 2) All the above 3) Value-returning 4) 0 to 9 5) 5020 6) Returns the product of all the values 7) one double value of 0.0 8) 7 9) local; static 10) characters 11) strcpy(s1, s2) ;
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.