1.
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;
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;
}
A. 
The cost for 15 items is 3.00, and the tax for 3.00 is 0.30;
B. 
The cost for 15 items is 0.00, and the tax for 3.00 is 0.00;
C. 
The cost for 15 items is 0.00, and the tax for 3.00 is 0.30;
D. 
The cost for 15 items is 3.00, and the tax for 3.00 is 0.00;
2.
Which of the following is not an example of a program bug?
A. 
B. 
C. 
D. 
3.
The set of instructions that a computer will follow is known as:
A. 
B. 
C. 
D. 
4.
Which of the following is not a valid identifier?
A. 
B. 
C. 
D. 
5.
What is the value of x after the following statements?
int x, y, z;
y = 10;
z = 3;
x = y * z + 3;
A. 
B. 
C. 
D. 
6.
What is the value of x after the following statements?
int x;
x = x + 30;
A. 
B. 
C. 
D. 
7.
What is the output of the following code?
float value;
value = 33.5;
cout << value << endl;
A. 
B. 
C. 
D. 
8.
Which of the following statements is NOT legal?
A. 
B. 
C. 
D. 
9.
An algorithm is
A. 
The inputs and outputs of a program
B. 
The part of the computer that does the processing
C. 
A finite set of steps to solve a problem
D. 
A complete computer program
10.
Which of the following is not a phase of the program-design process?
A. 
B. 
C. 
Marketing the final program
11.
Which of the following is not part of the Software Life Cycle?
A. 
B. 
C. 
D. 
E. 
12.
What is the value of x after the following statements?
int x;
x = 15 %4;
A. 
B. 
C. 
D. 
13.
What is the value of x after the following statement?
float x;
x = 3.0 / 4.0 + 3 + 2 / 5
A. 
B. 
C. 
D. 
14.
-
Which boolean operation is described by the following table?
A
B
Operation
True
True
True
True
False
True
False
True
True
False
False
False
A. 
B. 
C. 
D. 
15.
Which of the following data types may be used in a switch statement?
A. 
B. 
C. 
D. 
E. 
16.
What is wrong with the following for loop?
for(int i=0; i<10; i--)
{
cout << "Hello\n";
}
A. 
Can not use a for-loop for this
B. 
C. 
D. 
17.
What is the value of x after the following code fragment executes?
float x = 36.0;
x = sqrt(x);
A. 
B. 
C. 
D. 
18.
What is the output of the following program fragment?
cout << pow(4,2) << endl;
A. 
B. 
C. 
D. 
19.
Which boolean operation is described by the following table?
A
B
Operation
True
True
True
True
False
False
False
True
False
False
False
False
A. 
B. 
C. 
D. 
20.
When overloading a function, what must be true?
A. 
The names should be different with the same number and/or types of parameters.
B. 
The names should be the same with different number and/or types of parameters.
C. 
The names should be different with different number and/or types of parameters.
D. 
The names should be the same with the same number and/or types of parameters.
21.
When parameters are passed between the calling code and the called function, parameters and arguments are matched by:
A. 
B. 
Their relative positions in the parameter and argument lists
C. 
D. 
They are not matched up at all.
22.
The expression static_cast(3) is called a
A. 
B. 
C. 
D. 
23.
What is the value of the following?
sqrt(pow(2,4));
A. 
B. 
C. 
D. 
24.
Information Hiding is analogous to using
25.
What is the output of the following function call?
//function body
int factorial(int n)
{
int product=0;
while(n > 0)
{
product = product * n;
n—;
}
return product;
}
//function call
cout << factorial(4);
A. 
B. 
C. 
D.