Starting out with C++ Chapter 3 Quiz

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

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

cmath

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

fixed

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

getline

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

iostream header file

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

left

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

+

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;

13

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

39

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

2

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

3 * 2

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

4.0

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

parenthesis

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

setw

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

significant digits AND precision

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

x *= 2;

What operator follows the cin object?

>>

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 const int MY_VAL; 7 MY_VAL = 77; 8 cout << MY_VAL << endl; 9 return 0; 10 }

6 and 7

What operator follows the cout object?

<<

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

The data type of the variable

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

cin object

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

cin >> length >> width >> height;

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

(Parentheses)

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;

-3

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

0

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

number = number + 1;

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

overflows


Kaugnay na mga set ng pag-aaral

ITN262 Final Exam Prep - Chapter Review Questions

View Set

Unit 1 - Health History/General Survey

View Set

Lehne Chapter 53: Management of ST-Elevation Myocardial Infarction

View Set

BIO201 Osseous Tissue Review Guide

View Set

FIN CHAPTER 11: RISK AND RETURN IN CAPITAL MARKETS

View Set

DHY WGU Fundamentals of Interconnecting Network Devices - C246

View Set