cecs174exam2fall05sol

cecs174exam2fall05sol - CECS 174 FALL/05 EXAMINATION #2 65...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
CECS 174 EXAMINATION #2 NAME: FALL/05 65 points Fill In the Blank 10 points 1. Converting from one type to another is called ______________. ANSWER: casting 2. In the following function declaration, the variable size is known as a _________________. int myFunction ( int size); ANSWER: (formal) parameter 3. What is the output produced by the following code fragment? int i = 3; cout << "The value of i is " << sqrt(pow(i,4.0)) << endl; ANSWER: 9.0 4. Varibles that are declared inside a function are said to be _________ to that function. ANSWER: local 5. Constant variables that might be used in different functions should be _________ ANSWER: global 6. Write the code to declare an array of 10 doubles named list; ANSWER: double list[10]; 7. In the expression cout << score[i] << endl; i is called the ANSWER: index or subscript 8. An _______ is used to process a collection of data all of which is the same type ANSWER: array 9. How many indexed variables does the following array have? int myArray[]={1,2,3,6,5,4,7,1,2}; ANSWER: 9 10. Indexes are numbered starting at _________ ANSWER: 0
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Multiple Choice 19 points 1. If you need to write a function that will compute the cost of some candy, where each piece costs 25 cents, which would be an appropriate function declaration? a. int calculateCost(char name); b. char calculateCost(int count); c. int calculateCost int count; d. int calculateCost(int count); ANSWER: D 2. What is the value returned by the following function? int function() { int value = 35; return value + 5; value += 10; } a. 35 b. 40 c. 50 d. 10 ANSWER: B 3. The functions pow(), sqrt(), and fabs() are found in which include file? a.
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

cecs174exam2fall05sol - CECS 174 FALL/05 EXAMINATION #2 65...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online