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.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
This is the end of the preview.
Sign up
to
access the rest of the document.
 '09
 Natural number, Imperative programming, cout

Click to edit the document details