quiz2A - Sample questions True/False: Indicate whether the...

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

View Full Document Right Arrow Icon
True/False : Indicate whether the statement is true or false. ____ 1. Assume all variables are properly declared. The output of the following C++ code is 1 2 3 4 . n = 1; while (n < 5) { cout << 'n' << " "; n++; } ____ 2. Assume all variables are properly declared and the input is 6 8 5 3 –1 . The output of the following C++ code above is 22 . cin >> num; sum = num; while (num != -1) { cin >> num; sum = sum + num; } ____ 3. Assume that all variables are properly declared. The following statement in a value-returning function is legal. if (x % 2 == 0) return x; else return x + 1; ____ 4. Given the following code segment int g=10, i; for (i = 1; i < 3 ; i++) g+=i * 2; cout << endl << ++g << ” “ << ++i << endl; the output is: 4 17 Multiple Choice Identify the choice that best completes the statement or answers the question. ____ 5. What is the output of the following program segment? int x = 14;
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 04/04/2012 for the course CSCI 101L taught by Professor Ghyam during the Spring '07 term at USC.

Page1 / 3

quiz2A - Sample questions True/False: Indicate whether the...

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