CS 1336 EXAM 1 CHAPTER 3

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What is the value of cubeafter the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0);

125.0

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

3 * 2

How many characters will the following statement read into the variable myString? cin >> setw(10) >> myString;

9

What will be displayed after the following statements execute?int num1 = 5; int num2 = 3; cout << "The result is " << (num1 * num2 + 10) << endl;

The result is 25

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

True

The only difference between the getfunction and the >>operator is that getreads the first character typed, even if it is a space, tab, or the [Enter] key.

True

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

True

Which of the following functions will return the value of x, rounded to the nearest whole number?

round(x)

This manipulator is used to establish a field width for the value that follows it:

set

You can control the number of significant digits in your output with the __________ manipulator.

setprecision

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

the data type of the variable

When C++ is working with an operator, it strives to convert operands to the same type. This is known as

type conversion

.When a program uses the setwmanipulator, the iosetwidthheader file must be included in a preprocessor directive.

False

Arithmetic operators that share the same precedence have rightto left associativity.

False

In C++, it is impossible to display the number 34.789 in a field of 9 spaces with 2 decimal places of precision.

False

The fixedmanipulator causes a number to be displayed in scientific notation.

False

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

It allows four spaces for the value in num4.

Which of the following will allow the user to input the values 15and 20and have them stored in variables named baseand height, respectively?

cin >> base >> height;

Which of the following statements will pause the screen until the [Enter] key is pressed?

cin.get();

Which of the following statements will read an entire line of input into the string object, address?

cin.get(length >> width >> height);

Which of the following functions tells the cin object to skip one or more characters in the keyboard buffer?

cin.ignore

The function pow(x, y), requires which header file?

cmath

To use the rand()function, you must include the __________ header file?

cstdlib

This manipulator forces coutto print digits in fixed-point notation:

fixed

This manipulator causes the fieldto be left justified with padding spaces printed to the right:

left

Associativity is either right to left or

left to right

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

number *= 2;

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


संबंधित स्टडी सेट्स

History of Rock & Roll Final Study 2

View Set

Capítulo 27: Bacterias y Procariotas

View Set

Nutrition Exam 4 Study Set (Chapters 9 & 11)

View Set

RNSG 1137 PNC III final exam possible questions for final part 1

View Set

History 445 MIDTERM #3: CALIFORNIA RAILROADS

View Set

Investment Companies: Retirement/Education/Health Savings Plans

View Set