CISP 360 Ch 3

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

Evaluate each expression, assuming w = 1, x = 3,y = 4, and z = -2 then select the correct answer from the list. Assume that each expression is evaluated independently (i.e. if a variable is modified in one expression, it does not effect another expression). 4 % x * w - + z / 2 A B C D E

2

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = (MAX_I - 990) / a;]

3

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = a % (MAX_I - 990);]

3

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = a % b;]

3

The cin >> statement will stop reading input when it encounters a newline character.

True

You want the user to enter the length, width, and height from the keyboard. Which cin statement is correctly written?

cin >> length >> width >> height

The ________ causes a program to wait until information is typed at the keyboard and the Enter key is pressed.

cin object

Valid or Invalid? [MAX_ENTRIES]

valid

Valid or Invalid? [add5]

valid

Valid or Invalid? [netPay]

valid

Valid or Invalid? [power]

valid

Valid or Invalid? [this_is_a_long_one]

valid

Valid or Invalid? [xyz123]

valid

If valid expression, what's the output? [10.0 + 15 % 2 + 4.3]

15.3

If valid expression, what's the output? [10 + 17 % 3 + 4.]

16 or 16.0

If valid expression, what's the output? [10 + 17 % 3 + 4]

16 or 16.0

If valid expression, what's the output? [10.0 + 15 / 2 + 4.3]

21.3

If valid expression, what's the output? [10.0 + 15.0 / 2 + 4.3]

21.8

If valid expression, what's the output? [20.0 - 2 / 6 + 3]

23 or 23.0

If valid expression, what's the output? [3 * 4.0 / 6 + 6]

8 or 8.0

If valid expression, what's the output? [3.0 * 4 / 6 + 6]

8 or 8.0

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = PI * a;]

9

For each of the following expressions, indicate the order of evaluation of operators by selecting the correctly ordered list of letters that correspond to the operators. x * y / z + 30 % 2 - w A B C D E

A B D C E

For each of the following expressions, indicate the order of evaluation of operators by selecting the correctly ordered list of letters that correspond to the operators. x = y / z / w - z * z A B C D E

B C E D A

For each of the following expressions, indicate the order of evaluation of operators by selecting the correctly ordered list of letters that correspond to the operators. x += y / - z - 5 * w A B C D E

C B E D A

For each of the following expressions, indicate the order of evaluation of operators by selecting the correctly ordered list of letters that correspond to the operators. 4 % x * w - + z / 2 A B C D E

D A B E C

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = (989 - MAX_I) / a;]

-3

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = a / y;]

-3.0

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = PI * y;]

-3.14159

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = PI / y;]

-3.14159

Evaluate each expression, assuming w = 1, x = 3,y = 4, and z = -2 then select the correct answer from the list. Assume that each expression is evaluated independently (i.e. if a variable is modified in one expression, it does not effect another expression). x = y / z / w - z * z A B C D E

-6

Evaluate each expression, assuming w = 1, x = 3,y = 4, and z = -2 then select the correct answer from the list. Assume that each expression is evaluated independently (i.e. if a variable is modified in one expression, it does not effect another expression). x * y / z + 30 % 2 - w A B C D E

-7

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = a / -b;]

0

Evaluate each expression, assuming w = 1, x = 3,y = 4, and z = -2 then select the correct answer from the list. Assume that each expression is evaluated independently (i.e. if a variable is modified in one expression, it does not effect another expression). x += y / - z - 5 * w A B C D E

0

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = a / b;]

0.0

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = static_cast(a) / b;]

0.75

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = b % a;]

1

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = (MAX_I - 990) % a;]

1

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = b / a;]

1.0

What data type if result is valid? [10.0 + 15 % 2 + 4.3]

double

What data type if result is valid? [10.0 + 15 / 2 + 4.3]

double

What data type if result is valid? [3 * 4.0 / 6 + 6]

double

What data type if result is valid? [3.0 * 4 / 6 + 6]

double

What data type if result is valid? [10 + 17 % 3 + 4.]

double

What data type if result is valid? [10.0 + 15.0 / 2 + 4.3]

double

What data type if result is valid? [20.0 - 2 / 6 + 3]

double

What data type if result is valid? [10 + 17 % 3 + 4]

int

Valid or Invalid? [1A2345]

invalid

Valid or Invalid? ["joe's"]

invalid

Valid or Invalid? [#insert]

invalid

Valid or Invalid? [TWO*FOUR]

invalid

Valid or Invalid? [do]

invalid

Valid or Invalid? [joe's]

invalid

Valid or Invalid? [part#2]

invalid

Valid or Invalid? [void]

invalid

Valid or Invalid? [$taxes]

invalid

If valid expression, what's the output? [10 + 17 % 3. + 4]

invalid expression

If valid expression, what's the output? [3.0 * 4 % 6 + 6]

invalid expression

What data type if result is valid? [3.0 * 4 % 6 + 6]

invalid expression

What data type if result is valid? [10 + 17 % 3. + 4]

invalid expression

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = a % 0;]

invalid statement

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [i = b / 0;]

invalid statement

#define PI 3.14159 #define MAX_I 1000 double x, y; int a, b, i; Assume that a is 3, b is 4, and y is -1.0. [x = a % (a / b);]

invalid statement

The statement cin >> setw(10) >> str; will read up to this many characters into str.

nine

The total number of digits that appear before and after the decimal point is sometimes referred to as: Your answer: significant digits

significant digits


Ensembles d'études connexes

Language arts 8A- Words and how to use them~ STANDARD AND NONSTANDARD USAGE!!

View Set

Chapter 12 (Pre-quiz) : Lymphatic system

View Set

Read Theory - Novels and Novelists (Grade 12, 1240L)

View Set

Interpersonal Skills and I-Messages

View Set

Chapter 10: Health Inequalities, Environmental Racism, and Environmental Justice

View Set

Chapter 20: The Cardiovascular System: Vessels and Circulation

View Set

Chapter 21 assessment of cardiovascular function NCLEX Questions

View Set