quiz3_sol - CS 010 Intro to Computer Science I Spring -...

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 3 – Friday 4/18 SOLUTION Each question is worth 1 point. 1. All expressions in C++ must be terminated with a semicolon: a. True b. False 2. You are writing an inventory program, and need a variable to hold the number of cans in a box, which is 48 for the type of boxes your store currently handles. All of the following options are syntactically correct, but only one is in good style : which is it? a. int n = 48; b. int N = 48; c. const int N = 48; d. int cans_per_box = 48; e. const int CANS_PER_BOX = 48; f. const int cans_per_box = 48; 3. What value will the variable centigrade hold after the following statements have executed? double fahrenheit, centigrade; fahrenheit = 104.0; centigrade = (fahrenheit - 32) * (5 / 9); a. 0.0 b. 1.0 c. 40.0 d. 72.0 e. this is a mixed-type expression, and will result in a compiler (syntax) error 4. Which of the following statements does not have any syntax errors? (Assume int variables n1 , n2 , and
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

quiz3_sol - CS 010 Intro to Computer Science I Spring -...

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