chapter 3

Ace your homework & exams now with Quizwiz!

to use stream manipulators you should include the ___ header file

iomanip

in any program that uses the cin object, you must #include

iostream header

The statement cout << setw(4) << num4 << " ";

none of the above

which of the following statements will assign a number a value from 90-100

number=rand()%11+90

the cin object must be followed by

one or more stream extraction (>>) operators

when a arithmetic contains two or more different operators, such as * and + , the order in which the operations is done is determined by

operator precedence

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

operators, parentheses

can be used to override the rules of operator precedence

parentheses

operator associativity is either left to right or

right to left

the ____ stream manipulator can be used to establish a field width for the value immediately following it

setw

in c++ a value can be raised to power by using

the power function

The following statement sets sum1, sum2, and sum3 all to zero. sum1 = sum2 = sum3 = 0;

true

c+a*b c+(a*b)

true

result = a + b * c result=b*c+a

true

the cin object can be used to input more than one value in a single statement.

true

when an operators operands are of different data types, such as int and double c++ automatically converts one of them so that they are the same data type

true

the _____ operator always follows the cin object, and the ___ operator follows the cout object.

>>, <<

to use the sqrt () function, or other mathematical library functions, you must #include the ____ header file in your program

cmath

programs code that can be evaluated to a value is called a

expression

5 basic arithmetic operators are addition, subtraction, multiplication, division, and exponential

false

If the value of dollars is 5.0, the following statement will output 5.00 to the monitor: cout << fixed << showpoint << setprecision(4) << dollars << endl;

false

The following pair of C++ statements will cause 3.5 to be output double number = 7 / 2; cout << number;

false

The following statement sets the value of total to -3.

false

When an operator has two operands of different data types, C++ always converts them both to double before performing the operation.

false

const double taxrate; taxrate =.05;

false

int =3.0/2.0

false

the cin object lets the user enter a string that contains embedded blanks

false

the only difference between c string and string objects is how they are declared and internally stored. they are used exactly the same way

false

which of the following will allow an entire line of text to be read into a string object even if it contains embedded blanks?

getline()

the following statement number =rand () % 5 +10

10-14

What does the following C++ expression evaluate to? 6 - 6 / 3 + 3

7

The following 4 lines of C++ code, use strings. string firstName; // Define a string object char lastName[7]; // Define a C-string firstName = "Abraham"; // Assign a value to the string object lastName = "Lincoln"; // Assign a value to the C-string

The string object is assigned a value correctly, but the C-string is not

Which of the following statements about named constants is/are true?

a & c

hand tracing a program is

a program debugging technique

which of the following statements doubles the values stored in answer

both b and c , but not a

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

cin object


Related study sets

I Am Legend Besco Study Guide Chapter 1-5

View Set

IB BIO TOPIC 8.3 PHOTOSYNTHESIS HL, IB TOPIC 2.9 PHOTOSYNTHESIS SL, IB BIO TOPIC 2.8 CELL RESPIRATION SL, IB BIO TOPIC 8.2 CELL RESPIRATION HL

View Set

AP European History Second Semester Final Practice Test 3

View Set

Certified Scrum Master Studyguide

View Set