1. Logic errors are
More information: Lesson 3.2.2
2. Which of the following is a valid identifier?
big-number50Percentdouble_SalesTaxMore information: Lesson 2.3.4
3. What is the output from the following loop:
int i = 10; while (i >= 0) cout << i << endl; i--;
More information: Lesson 5.1.5
4. Given a single C++ program, which of the following functions can it have?
A. foo(int a)
B. foo(int a, int b)
C. foo(double a)
D. foo(double a, double b)
E. foo(int b)
More information: Lesson 6.3
5. What is the output of the following function and function call?
void calculateCost(int count, float& subTotal, float taxCost);
float tax = 0.0,
subTotal = 0.0;
// start of fragment
calculateCost(15, subTotal, tax);
cout << "The cost for 15 items is " << subTotal
<< ", and the tax for " << subTotal << " is "
<< tax << endl;
// end of fragment
void calculateCost(int count, float& subTotal, float taxCost) {
if ( count < 10) {
subTotal = count * 0.50;
} else {
subTotal = count * 0.20;
}
taxCost = 0.1 * subTotal;
}
More information: Lesson 7.2