C++ PROGRAMMING 1 CH2-CH11

Ace your homework & exams now with Quizwiz!

The ________ causes the content of another file to be inserted into a program. cout object double slash (//) #include directive semicolon (;) None of these

#include directive

What is the value of x after the following code executes? int x; x = 3 / static_cast<int>(4.5 + 6.4); 0.3 0 0.275229 3.3 None of these

0

What is output of the following statement? cout << 4 * (15 / (1 + 3)) << endl; 15 12 63 72 None of these

12

What is the value of cube after the following code executes? double cube, side; side = 5.0; cube = pow(side, 3.0); 25.0 15.0 125.0 8.0 unknown

125.0

If you want to know the length of the string that is stored in a string object, you can call the object's size member function. True False

False

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

False

A variable's ________ is the part of the program that has access to the variable. data type value scope assignment None of these

Scope

What will the following code display? int number = 23; cout << "The number is " << "number" << endl; The number is number The number is null The number is 23 The number is23 The number is

The number is number

The ________ causes a program to wait until information is typed at the keyboard and the [Enter] key is pressed. output stream cin object cout object preprocessor None of these

cin object

Which of the following statements will pause the screen until the [Enter] key is pressed? cin.getline(); cin.get(); cin.input(); cin; cin.ignore()

cin.get();

Which of the following functions tells the cin object to skip one or more characters in the keyboard buffer? cin.ignore cin.jump cin.hop cin.skip None of these

cin.ignore

To use the rand()function, you must include the ________ header file? iostream cstdlib cmath iomanip cstring

cstdlib

Which of the following statements correctly defines a named constant named TAX_RATE that holds the value 0.075? double TAX_RATE = 0.075; const double TAX_RATE = 0.075; const TAX_RATE = 0.075; double TAX_RATE;const TAX_RATE = 0.075; const TAX_RATE;double TAX_RATE = 0.075;

double TAX_RATE = 0.075;

Which of the following defines a double-precision floating-point variable named payCheck? payCheck double; double payCheck; float payCheck; Double payCheck;

double payCheck;

In a cout statement, which of the following will advance the output position to the beginning of the next line? \t or \b endl or \n \n or \t end1 or /n \\ or \'

endl or \n

What is the value of cookies after the following statements execute?int number = 38, children = 4, cookies; cookies = number % children; 9.5 4 2 .5 9

2

What will the following code display? int x = 23, y = 34, z = 45; cout << x << y << z << endl; xyz 233445 23 34 45 233445

233445

What is the value of number after the following statements execute?int number;number = 18 % 4 + 2; 3 4 6.5 0 unknown

4

CHAPTER 2 SECTION

CHAPTER 2 SECTION

CHAPTER 3 SECTION

CHAPTER 3 SECTION

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 5 * 3 + 10 The result is (num1 * num2 + 10) The result is 25 The result is 65 None of these

The result is 25

A named constant is like a variable, but it its content cannot be changed while the program is running. True False

True

Arithmetic operators that share the same precedence have right to left associativity.

True False

A debugging process where you, the programmer, pretend you are a computer and step through each statement while recording the value of each variable at each step is known as error checking hand writing hand tracing error handling None of these

hand tracing

When a user types values at the keyboard, those values are first stored as ASCII characters in the header file iostream in the keyboard buffer as integers None of these

in the keyboard buffer

This manipulator causes the field to be left justified with padding spaces printed to the right: left_justify right left left_pad None of these

left_justify

Which line in the following program will cause a compiler error? #include <iostream> using namespace std; int main() { const int MY_VAL = 77; MY_VAL = 99; cout << MY_VAL << endl; return 0; } line 6 line 7 line 8 line 9 there will be no compiler error

line 7

A(n) ________ represents a storage location in the computer's memory. literal variable comment integer None of these

literal

Assuming that a program has the following string object definition, which statement correctly assigns the string literal "Jane" to the string object?string name; name = <Jane> name = Jane; name = "Jane"; string name = {Jane}; name = 'Jane';

name = "Jane";

Besides the decimal number system that is most common (base 10), two other number systems that can be used in C++ programs are octal and fractal octal and hexadecimal base 2 and base 4 base 2 and binary None of these

octal and hexadecimal

A statement that starts with a hashtag (or pound) symbol ( #) is called a comment function preprocessor directive header file None of these

preprocessor directive

Which of the following functions will return the value of x, rounded to the nearest whole number? sqrt(x) whole(x) round(x) abs(x) fmod(xc)

round(x)


Related study sets

incorrect problems on stats medic

View Set

BUSI - Ch. 16 (Understanding Financial Management and Securities Markets)

View Set

4th Level Exam 4 nclex style questions

View Set

Compensation Chapter 7 ( TEST 3 )

View Set

abnormal psych final chapter 17, 18, 19

View Set

PEARSON Math Answers (Using and Understanding Mathematics: A Quantitative Reasoning Approach 7th Edition)

View Set