{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

cs10_07spr_samplefinal_sol

cs10_07spr_samplefinal_sol - Last name SID(last 4 digits...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
Last name: _____________________ First name: ___________________________ SID (last 4 digits): __________ login id: __________ CS 010 – Intro to Computer Science I Spring - 2007 Sample Final exam - total 100 points SOLUTION Time: 3 hours You may have on your desks ONLY this exam, your personalized multiple choice answer sheet, a writing implement and an eraser, and your student ID. You may use a separate sheet(s) of scratch paper. Make good use of this – don’t write your answers in the assigned space until you are sure of them! WRITE CLEARLY IN THE SPACE PROVIDED. WARNING !!!: POINTS WILL BE DEDUCTED FOR MESSY & HARD-TO-READ HANDWRITING!!! Section I (questions 1 to 25) are to be answered on your multiple choice answer sheets; Section II (questions 1 to 5) on this exam booklet. Hand both in together. You will be required to show your student ID when you hand in your exam. Be sure to read each problem carefully and follow the directions. Section I 25 Section II Q.1 15 Section II Q.2 15 Section II Q.3 15 Section II Q.4 15 Section II Q.5 15 TOTAL 100
Image of page 1

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

View Full Document Right Arrow Icon
Last name: _____________________ First name: ___________________________ Section I: Multiple choice – 1 point each 1. Which of the following is NOT a valid assignment statement? a. product = n * m; b. n + m = sum; c. result = result + 5; d. 5 = n – m; e. b & d f. c & d 2. Which of the following data types is not “built into” the core C++ language? 3. What is output to the screen with the following statements? string name = “Johnson”; cout << name.substr(4, 3); 4. What is the output of the following code fragment? cout << fixed << setprecision(1) << setw(4) << 1.234 << endl << setw(4) << 12.34 << endl; 5. The value of the expression ( 20.0 * (9/5) ) + 32.0 is: a. 68.0 b. 93.6 c. 32.0 d. 52.0 e. this is a mixed-type expression, so it will not compile 2
Image of page 2
Last name: _____________________ First name: ___________________________ 6. getline( istream, string_variable ) is a function provided by the string library to work with input stream objects such as cin . The effect of the instruction getline( cin, abc ); //where abc is a valid string variable is: a. to populate the string abc with the entire line entered at the keyboard, up to the newline character b. to populate the string abc with the next character in the input stream buffer c. to return the number of characters currently in the input stream buffer as an int d. to return a bool indicating whether the end of file has been reached e. the same as cin >> abc;
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
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