quiz4_sol - CS 010 Intro to Computer Science I Spring 2008...

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

View Full Document Right Arrow Icon
CS 010 – Intro to Computer Science I Spring - 2008 Quiz 4 – Friday 4/25 SOLUTION Each question is worth 1 point. 1. Which of the following statements does not have any syntax errors? (Assume int variables n1 , n2 , and n3 have all been correctly declared and initialized as needed). a. cout << n1, n2, n3; b. cin >> n1 >> n2 >> n3; c. cout << n1; << n2; << n3; d. cin >> n1, n2, n3; e. b) and c) f. none: all of them are syntactically correct 2. What is the exact output of the following code fragment? (Note : the dots on the last line of each answer are simply to help you count spaces) double x = 98.7656789; cout << fixed << setprecision(1); cout << setw(8) << x << endl; cout << setprecision(3); cout << setw(8) << x << endl; a. 98.7 98.765 ........ b. 98.7 98.765 ........ c. 98.8 98.766 ............. d. 98.70000 98.76500 ........ e. 98.8 98.766 ........ f. 98.8 98.766 ........ 3. What value will the variable n hold after the following statements have executed? int n = 42;
Background image of page 1

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

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

This note was uploaded on 06/05/2008 for the course CS 010 taught by Professor Linard during the Spring '08 term at UC Riverside.

Page1 / 2

quiz4_sol - CS 010 Intro to Computer Science I Spring 2008...

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