Exam1COSC140Revi_36521[1]

Exam1COSC140Revi_36521[1] - Exam 1 COSC140 Review 1....

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

View Full Document Right Arrow Icon
Exam 1 COSC140 Review 1. Convert each of the following mathematical formulas to a C++ expression. 3x 3x+y x+y 3x+y ---- ------ 7 z+2 2. What is the output of the following program lines when they are embedded in a correct program that declares number to be of type int? Number = (1/3) * 3; Cout<< “(1/3) * 3 is equal to “ << number; 3. Write a C++ program that reads two whole numbers into two variables of type int and then outputs both the whole number part and the remainder when the first number is divided by the second. 4. What statements should you include in your program to ensure that when a number of type double is output, it will be ouptut in ordinary notation with three digits after the decimal point? 5. Determine the value, true or false, of each of the following Boolean expressions, assuming that the value of the variable count is 0 and the value of the variable limit is 10. Give your answer as one of the values true or false. A. (count == C. (limit > 20) || (count < 5) D. !(count == 12) F. (count < 10) || (x < y) G. !( ((count < 10 || (x < y) )&& (count >= 0) H. ((limit/count) / 7) || (limit < 20)
Background image of page 1

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

View Full DocumentRight Arrow Icon
I. (limit < 20) || ((limit / count) > 7)
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.

This note was uploaded on 07/24/2010 for the course CS 101 at USC.

Page1 / 7

Exam1COSC140Revi_36521[1] - Exam 1 COSC140 Review 1....

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