quiz8_001_sol

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

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 Fall - 2007 Quiz 8 – Tuesday 12/4 - Section 001 SOLUTION 1. Given the following code fragment, which of the following expressions is always true? int x; cin >> x; a. ( x < 3 ) b. ( x == 1 ) c. ( (x / 3) > 1 ) d. ( x = 1 ) e. None of the above - the value always depends on the value provided for x. 2. Given the Time class of the text, which of the following statements correctly declares an object of type Time ? a. Time t = now(); b. Time breakfast(); c. Time lunch = Time(12, 15, 0); d. Time snack(15, 0, 0); e. Time dinner = (17, 30, 0); f. c) and d) 3. What is output by the following code? int n = 10; do{ cout << n << “ “; ++n; } while (n < 5); cout << n << endl; a. 10 b. 10 11 c. 11 d. 10 10 e. 11 12 f. There is a syntax error in this code. 4. The following code is an example of a sentinel controlled loop. On a linux system, what is the sentinel that will terminate the loop? while (cin >> var) //var is an appropriately defined variable
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.

Page1 / 2

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

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