CS 2.2
Consider the following code. // Insertion Point 1 using namespace std;const float PI = 3.14; int main(){ //Insertion Point 2 float r = 2.0; float area; area = PI * r * r; cout << "Area = " << area <<endl; return 0; } // Insertion Point 3 In this code, where does the include statement belong? A: Insertion Point 1 B: Insertion Point 2 C: Insertion Point 3 D: Anywhere in the program
A: Insertion Point 1
Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) ____. A: beta = beta + 1; alpha = beta; B: alpha = beta;b eta = beta + 1; C: alpha = alpha + beta; D: alpha = beta + 1;
A: beta = beta + 1; alpha = beta;
Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____. A. 1 B. 2 C. 3 D. 4
B. 2
____ are executable statements that inform the user what to do. A: Variables B: Prompt lines C: Named constants D: Expressions
B: Prompt lines
Which of the following is the newline character? A: \r B: \n C: \l D: \b
B: \n
The declaration int a, b, c; is equivalent to which of the following? A: inta , b, c; B: int a,b,c; C: int abc; D: int a b c;
B: int a,b,c;
Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____. A. alpha = 1 - beta; B. alpha = beta - 1; C. beta = beta - 1;alpha = beta; D. alpha = beta;beta = beta - 1;
C. beta = beta - 1;alpha = beta;
Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl; A: Sunny \nDay B: Sunny \nDay endl C: Sunny Day D: Sunny \n Day
C: Sunny Day
Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____. A: alpha = 5 B: alpha = 10 C: alpha = 50 D: alpha = 50.0
C: alpha = 50
Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ____. A: alpha = 1 + beta; B: alpha = alpha + beta; C: alpha = beta; beta = beta + 1; D: beta = beta + 1; alpha = beta;
C: alpha = beta; beta = beta + 1;
Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____. A: alpha = 1 - beta; B: alpha = beta - 1; C: beta = beta - 1; alpha = beta; D: alpha = beta; beta = beta - 1;
D: alpha = beta; beta = beta - 1;
Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____. A: sum = 0 B: sum = 5 C: sum = 10 D: sum = 15
D: sum = 15
Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7;
True
Suppose a = 5. After the execution of the statement ++a; the value of a is 6.
True