CSC 2000 Final Exam Solutions - CSC 2000 Introduction to C Programming Language Spring/Summer Term 2014 Final Exam Last name First name ID Directions a

CSC 2000 Final Exam Solutions - CSC 2000 Introduction to C...

This preview shows page 1 - 5 out of 23 pages.

CSC 2000 Introduction to C++ Programming Language Spring/Summer Term 2014 Final Exam Last name: ________________________________ First name: ________________________________ ID: _______________________________________ Directions: a. Please fill in the requested information at the top of this exam. b. This exam contains 50 multiple choice questions and 3 programming questions; each multiple choice question worth 4 points, total of 200 points. The programming questions worth 170 points.c. The exam is Opened Book/Opened Notes. You have 95 minutes to complete the exam. The total points for the entire exam are 370 points. d. No electronic devices may be used during the examination, i.e. no cell phones, mp3 players, laptops, etc. calculator okay. e. Questions will not be interpreted during the examination except for the programming part. f. For multiple choice questions, you should choose the single best alternative for each question, evenif you believe that a question is ambiguous or contains a typographic error. Provide only one answer. g. When completing the exam, please leave the room and be courteous to those still taking the exam. 1
Image of page 1

Subscribe to view the full document.

Identify the choice that best completes the statement. . ____ 1. The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____. a. 13 c. 14.8 b. 14 d. 15 ____ 2.Suppose that alphaand betaare intvariables. The statement alpha = beta++;is equivalent to the statement(s) ____. ____ 3.Choose the output of the following C++ statement:cout << "Sunny " << '\n' << "Day " << endl; ____ 4.Suppose that xand y are int variables, zis a doublevariable, and the input is:28 32.6 12Choose the values of x, y, and zafter the following statement executes:cin >> x >> y >> z; ____ 5.Suppose thatx is anint variable. Which of the following expressions always evaluates to true? a.(x > 0) || ( x <= 0)c.(x > 0) && ( x <= 0)b.(x >= 0) || (x == 0)d.(x > 0) && (x == 0) ____ 6.What is the output of the following code fragment if the input value is 4?int num; 2
Image of page 2
int alpha = 10; cin >> num; switch (num) { case 3: alpha++; break; case 4: case 6: alpha = alpha + 3; case 8: alpha = alpha + 4; break; default: alpha = alpha + 5; } cout << alpha << endl; ____ 7.Supposesumand numare intvariables, and the input is 18 25 61 6 -1. What is the output of the following code?sum = 0;cin >> num;while (num != -1){sum = sum + num;cin >> num;}cout << sum << endl; ____ 8.What is the value of xafter the following statements execute?int x = 5;int y = 30;dox = x * 2;while (x < y); 3
Image of page 3

Subscribe to view the full document.

____
Image of page 4
Image of page 5

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

Ask Expert Tutors You can ask 0 bonus questions You can ask 0 questions (0 expire soon) You can ask 0 questions (will expire )
Answers in as fast as 15 minutes