Exam 1- 2010

To write a complete program you must write the include

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: y libraries have been included. In a snippet of code, DO NOT use return statements to end the program! • To write a complete program, you must write the #include statements, the int main(), etc. in your solution to receive full credit. • A line consisting solely of “…” represents one or more C++ statements, some of which may change the values of program variables. Grade (instructor use only) Your Score Max Score Problem 1 24 Problem 2 16 Problem 3 30 Problem 4 30 Total 100 Problem 1: 24 points. What will print to the screen when each of the following snippets of code is executed? (a) cout << (pow(2, 3))/2 << endl; (b) int x = 4; cout << x << endl; (c) int a = 17; int b = 5; cout << a % b << endl; CS 115 Exam 1, Spring 2010 Page 2 of 7 (d) int x; cin >> x; while (x > 0) { x--; } while (x < 0) { x++; } cout << x <&l...
View Full Document

This note was uploaded on 02/08/2014 for the course CS 115 taught by Professor Staff during the Fall '08 term at Sonoma.

Ask a homework question - tutors are online