CS hw 2.1

Pataasin ang iyong marka sa homework at exams ngayon gamit ang Quizwiz!

The expression static_cast<int>(6.9) + static_cast<int>(7.9) evaluates to ____. A: 13 B: 14 C: 14.8 D: 15

A: 13

The expression static_cast<int>(9.9) evaluates to ____. A: 9 B: 10 C: 9.9 D: 9.0

A: 9

Which of the following is a reserved word in C++? A: char B: Char C: CHAR D: character

A: char

____ is a valid char value. A: "-129" B: 'A' C: "A" D: 129

B: 'A'

The value of the expression 33/10, assuming both values are integral data types, is ____. A: 0.3 B: 3 C: 3.0 D: 3.3

B: 3

____ is a valid int value. A: 46,259 B: 46259 C: 462.59 D: -32.00

B: 46259

The memory allocated for a float value is ____ bytes. A: two B: four C: eight D: sixteen

B: four

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, ____. A: one = 10.5, two = 10.5 B: one = 10.5, two = 30.6 C: one = 30.6, two = 30.6 D: one = 11, two = 31

B: one = 10.5, two = 30.6

Which of the following is a legal identifier? A: program! B: program_1 C: 1program D: program 1

B: program_1

The length of the string "computer science" is ____. A: 14 B: 15 C: 16 D: 18

C: 16

The value of the expression 17 % 7 is ____. A: 1 B: 2 C: 3 D: 4

C: 3

An example of a floating point data type is ____. A: int B: char C: double D: short

C: double

The ____ rules of a programming language tell you which statements are legal, or accepted by the programming language. A: semantic B: Logical C: syntax D: grammatical

C: syntax

A comma is also called a statement terminator.

False

A mixed arithmetic expression contains all operands of the same type.

False

An operator that has only one operand is called a unique operator.

False

In C++, reserved words are the same as predefined identifiers.

False

The escape sequence \r moves the insertion point to the beginning of the next line.

False

If a C++ arithmetic expression has no parentheses, operators are evaluated from left to right.

True

The maximum number of significant digits in float values is up to 6 or 7.

True

The maximum number of significant digits in values of the double type is 15.

True

Evaluate the following expressions. a. 28 - 3 + 6 b. 6 / 5 c. 3 * 6 / 2 - 15 d. 4 - 6 % 11 e. 37 / 4.0 f. 15 + 18 % 2 - 20 / 6 g. 32 % 12 + 6 - 36 / 5 * 8 h. 5 / 9 * (32.6 - 4.5) i. 18.0 + 5.0 * 3.0 /4.0

a. 31 b. 1 c. -6 d. -2 e. 9.25 f. 12 g. -42 h. 0 i. 21.75


Kaugnay na mga set ng pag-aaral

DIET FINAL CHP. 13 TRACE MINERALS

View Set

Chapter 16-17: Acid-Base Equilibria

View Set

Excel Final Exam Review Higher Difficulty Questions

View Set

chapter 8 political participation and voting

View Set

DECA- Principles of Finance Performance Indicators

View Set