quiz4_001_sol

quiz4_001_sol - CS 010 Intro to Computer Science I Fall...

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

View Full Document Right Arrow Icon
CS 010 – Intro to Computer Science I Fall - 2007 Quiz 4 – Thursday 10/25 - section 001 SOLUTION Each question is worth 1 point. 1. What is the value of the following expression: (5 != 10) a. true b. false c. 5 d. 10 2. What is output by the following code if the user enters 200.00 ? double tax_rate = 0.0; double price; cout << "enter the base price of the item\n"; cin >> price; cout << fixed << setprecision(2); if (total > 300.0) { tax_rate = 0.10; } cout << price + (price * tax_rate) << endl; a. 0.00 b. 200.00 c. 20.00 d. 220.00 e. none of the above Use this code fragment for the following 3 questions int n = 1; int product = 1; while (n < 3) { product = product * n; ++n; } cout << product << endl; 3. What will be output by the code fragment? a. 1 2 b. 1 2 3 c. 1 2 6 d. 2 e. 6 f. none of the above
Background image of page 1

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

View Full DocumentRight Arrow Icon
4. What value does n hold after the code executes? a. 0 b. 1 c. 2 d. 3 e. 4 5. How many times is the conditional expression evaluated? a.
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 / 3

quiz4_001_sol - CS 010 Intro to Computer Science I Fall...

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