Exam #2 Solutions

Exam #2 Solutions - Page |1 CSE 100 (9:15 am 10:30 am):...

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

View Full Document Right Arrow Icon
P a g e | 1 CSE 100 (9:15 am – 10:30 am): Principles of Programming with C++ Department of Computer Science Arizona State University, Fall 2007 Midterm II - Solutions 100 Points Your Name: Solutions Directions: Total time for the test is 1 hour and 15 minutes. Answer all questions. Show your work clearly so that you may get partial points even if your final answer is wrong!) GOOD LUCK!!! True/False [17 Points] 1. Indicate whether the statement is true or false. F a) F b) In C++, case is a reserved word, but break is not a reserved word. F c) In a switch statement, every case must have a break. T d) [3 points] Assume all variables are properly declared. The output of the following C++ code is 0 1 2 3 4. n = 0; while (n < 5) { cout << n << " "; n++; } Problem Page Possible Your Score 1 1 17 2 2 19 3 4 19 4 6 15 5 7 16 6 8 14 Total
Background image of page 1

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

View Full DocumentRight Arrow Icon
P a g e | 2 F e) Assume all variables are properly declared. The output of the following C++ code is 1 2 3 4 5 6 7 8 9 10. for (i = 1; i <= 10; i++); cout << i << " " ; T f) The do. ..while loop has an exit condition but no entry condition. T g) If a continue statement is placed in a do. ..while structure, the loop-continue test is evaluated immediately after the continue statement. F h) To use a predefined value-returning function in a program, the programmer only needs to know the appropriate header file(library), the name of the function, and the type of the value returned by the function. Multiple Choice [19 Points] 2. Identify the choice that best completes the statement or answers the question. C
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

Exam #2 Solutions - Page |1 CSE 100 (9:15 am 10:30 am):...

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