Chapter 2 CS 1436

Ace your homework & exams now with Quizwiz!

The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____.

13

The length of the string "computer science" is ____.

16

Suppose that count is an int variable and count = 1. After the statement count++; executes, the value of count is ____.

2

The value of the expression 33/10, assuming both values are integral data types, is ____.

3 (not 3.0)

Suppose that alpha and beta are int variables. The statement alpha = ++beta; is equivalent to the statement(s) ____.

beta = beta + 1; alpha = beta;

Suppose that alpha and beta are int variables. The statement alpha = --beta; is equivalent to the statement(s) ____.

beta = beta - 1; alpha = beta;

____ is a valid int value.

46259 (no decimals)

The expression static_cast<int>(9.9) evaluates to ____.

9

In a C++ program, one and two are double variables and input values are 10.5 and 30.6. After the statement cin >> one >> two; executes, ____.

one = 10.5, two = 30.6

Suppose that sum and num are int variables and sum = 5 and num = 10. After the statement sum += num executes, ____.

sum = 15

A comma is also called a statement terminator. (T/F)

False

A mixed arithmetic expression contains all operands of the same type. (T/F)

False

An operator that has only one operand is called a unique operator. (T/F)

False

The escape sequence \r moves the insertion point to the beginning of the next line. (T/F)

False

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

Insertion Point 1

Suppose a = 5. After the execution of the statement ++a; the value of a is 6. (T/F)

True

Suppose that sum is an int variable. The statement sum += 7; is equivalent to the statement sum = sum + 7; (T/F)

True

The maximum number of significant digits in float values is up to 6 or 7. (T/F)

True

The maximum number of significant digits in values of the double type is 15. (T/F)

True

Suppose that alpha and beta are int variables and alpha = 5 and beta = 10. After the statement alpha *= beta; executes, ____.

alpha = 50

Suppose that alpha and beta are int variables. The statement alpha = beta++; is equivalent to the statement(s) ____.

alpha = beta; beta = beta + 1;

Suppose that alpha and beta are int variables. The statement alpha = beta--; is equivalent to the statement(s) ____.

alpha = beta; beta = beta - 1;

The value of the expression 17 % 7 is ____.

3

____ is a valid char value.

'A' (no quotations, just apostrophe)

____ are executable statements that inform the user what to do.

Prompt lines

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right. (T/F)

True

Which of the following is the newline character?

\n

Which of the following is a legal identifier?

program_1

A(n) ____________________ is a memory location whose contents can be changed.

variable location variable Variable named location

Choose the output of the following C++ statement: cout << "Sunny " << '\n' << "Day " << endl;

Sunny \nDay

Which of the following is a reserved word in C++?

char

An example of a floating point data type is ____.

double

The memory allocated for a float value is ____ bytes.

four

The declaration int a, b, c; is equivalent to which of the following?

int a,b,c;


Related study sets

Symbols for Categorical and Quantitative Variables

View Set

HESI Case Study - Hip Fracture and Cellulitis

View Set

Indian History, From Shastri to Gandhi (16).

View Set

Biology 102 chapter#1 (Michelle)

View Set

Test Out Linux Pro 3.3.4 Practice Questions

View Set