cecs174exam2fall05sol

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

Info icon This is a preview. 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
Image of page 1
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?
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern