cpp1_mult_f07 - CGS-2425 C++ EXAM 1, TEST FORM CODE...

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: CGS-2425 C++ EXAM 1, TEST FORM CODE "A", SPECIAL CODE 71, FALL 2007 This exam is OPEN BOOK, OPEN NOTES, CLOSED NEIGHBOR. Cheaters will receive a ZERO on the exam. Assume <iostream> and <cmath> have been included prior to any partial C++ code. 1. How many of the following variable names are valid in standard C++ ? pre% sqr ft 4sale G8while cgs_class A. 1 B. 2 C. 3 D. 4 E. 5 2. Consider the following C++ statements. Assume n and k are int variables. (1) cout << n, "is greater than", k; (2) if (n) 5 = k; (3) while (n>0 && n<5) n+=k; (4) if [n == 5] cout << "n is equal to 5." ; Which of the above contain syntax errors and will cause a compilation error? A. 1 and 2 B. 2 and 3 C. 1 and 4 D. 1, 2 and 4 E. 2, 3 and 4 3. Below is a C++ program. #include <iostream> using namespace std; int main(void) { double x = 4 / 3.0; double y = 4 / 3; cout << "x = " << x; cout << " y = " << y << endl; cout.setf(ios::showpoint|ios::fixed); cout.precision(3); cout << "x = "; cout.width(5); cout << x; cout << " y = " << y << endl; return 0; }...
View Full Document

Page1 / 4

cpp1_mult_f07 - CGS-2425 C++ EXAM 1, TEST FORM CODE...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online