ITSC Chapter 3

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

True/False: Arithmetic operators that share the same precedence have right to left associativity.

False

True/False: The fixed manipulator causes a number to be displayed in scientific notation.

False

What will the value of result be after the following statement executes? result = 6 - 3 * 2 + 7 - 10 / 2;

a. 2

What is the value of number after the following statements execute? int number = 10; number += 5; number -= 2; number += 3;

a. 39

What is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;

a. 4.0

Which is true about the following statement? cout << setw(4) << num4 << " ";

a. It allows four spaces for the value in the variable num4.

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

a. Nine

This function tells the cin object to skip one or more characters in the keyboard buffer.

a. cin.ignore

When using the sqrt function you must include this header file.

a. cmath

Which statement is equivalent to the following? number += 1;

a. number = number + 1; Correct

You can use these to override the rules of operator precedence in a mathematical expression.

b. (Parentheses)

What is the value stored at x, given the statements: int x; x = 3 / static_cast<int>(4,5+6.4);

b. 0

In the following C++ statement, what will be executed first according to the order of precedence? result = 6 - 3 * 2 + 7 - 10 / 2;

b. 3 * 2

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

b. cin object Correct

________ reads a line of input, including leading and embedded spaces, and stores it in a string object.

b. getline

In any program that uses the cin object, you must include the ________.

b. iostream header file

When a variable is assigned a number that is too large for its data type, it:

b. overflows

Which statement is equivalent to the following? x = x * 2

b. x *= 2; Correct

True/False: The cin << statement will stop reading input when it encounters a newline character.

True

True/False: When C++ is working with an operator, it strives to convert the operands to the same type.

True

True/False: When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.

True

When converting some algebraic expressions to C++, you may need to insert ________ that do not appear in the algebraic expression.

a. (Parentheses)

What will the value of x be after the following statements execute? int x = 0; int y = 5; int z = 4; x = y + z * 2;

c. 13

The ________ operator always follows the cin object, and the ________ operator follows the cout object.

c. >>, <<

Associativity is either right to left or:

c. Left to right

When the final value of an expression is assigned to a variable, it will be converted to:

c. The data type of the variable

The function, pow(x, 5.0), requires this header file.

c. cmath

This stream manipulator forces cout to print the digits in fixed-point notation.

c. fixed

Which statement will read an entire line of input into the following string object? string address;

c. getline(cin, address);

This manipulator causes the field to be left-justified with padding spaces printed to the right.

c. left

This manipulator is used to establish a field width for the value immediately following it.

c. setw

When this operator is used with string operands it concatenates them, or joins them together.

d. +

Assume that x is an int variable. What value is assigned to x after the following assignment statement is executed? x = -3 + 4 % 6 / 5

d. -3

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

d. cin >> length >> width >> height;

To use the rand() function, you must #include this header file in your program.

d. cstdlib

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

d. significant digits and precision

This statement will pause the screen, until the [Enter] key is pressed.

e. cin.get();


Set pelajaran terkait

Module 6 - Network Design and Access Layer Quiz

View Set

PMP 8: Project Quality Management

View Set

Financial Reporting and Analysis

View Set

QUIZ 14 FRIDAY 10/6 p90-91 & 94-96 Endocrine System, Brain Scans, Parietal Lobe

View Set

Chemistry Unit 5 lesson 8 Gases Unit Test

View Set

Psychology 1000 Final Exam Practice

View Set

Ch. 5 Investigating God's World A Beka Book 5th Grade

View Set

Life Insurance Policies and Annuity Contracts

View Set