CS135- chapter 3 quiz

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

Which line in the following program will cause a compiler error? 1 #include 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

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

7

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

>>, <<

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

floating points significant digits B and C

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

iostream header file

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

number = number + 1;

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

overflows

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

setw

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

x *= 2;

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

fixed

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

(Parentheses)

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

0

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 is the value of average after the following code executes? double average; average = 1.0 + 2.0 + 3.0 / 3.0;

4.0

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

The data type of the variable

You want to read 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

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

cmath

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

cstdlib


Set pelajaran terkait

Pharmacology ATI study questions part 20

View Set

Introduction to Experimentation - Final

View Set

Chapter 13 Heart Disease, Hypertension, Stroke, and Type 2 Diabetes

View Set

international relations quiz 2 study guide

View Set

LING 2750 - FINAL EXAM Quiz Questions

View Set

Pharmacology Exam 5 Ch.19-24 (Online Questions)

View Set

Chapter Exam- Disability Insurance

View Set

Vocabulary Workshop Level F Unit 9-15

View Set