Final Exam Quiz Reviews

Ace your homework & exams now with Quizwiz!

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 output of the following code segment? n = 1; for ( ; n <= 5; ) cout << n << ' '; n++;

1 1 1 ... and on forever

True/False: Although two-dimensional arrays are a novel idea, there is no known way to pass one to a function.

False

These are used to declare variables that can hold real numbers.

Floating point data types

In C++ 11, if you want an integer literal to be treated as a long long int, you can append ________ at the end of the number.

LL

In a function header, you must furnish:

data type(s) of the parameters data type of the return value the name of function names of parameter variables

A ________ argument is passed to a parameter when the actual argument is left out of the function call.

default

These types of arguments are passed to parameters automatically if no argument is provided in the function call.

default

A function ________ contains the statements that make up the function.

definition

You must have a ________ for every variable you intend to use in a program.

definition

It is a good programming practice to ________ your functions by writing comments that describe what they do.

document

Look at the following function prototype. int myFunction (double); What is the data type of the function's parameter variable?

double

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

double payCheck;

The individual values contained in array are known as ________.

elements

This vector function returns true if the vector has no elements.

empty

This function causes a program to terminate, regardless of which function or control mechanism is executing.

exit()

If you want a user to enter exactly 20 values, which loop would be the best to use?

for

If you use a C++ key word as an identifier, your program will:

not compile

Of the following, which is a valid C++ identifier?

All of these are valid identifiers.

What will the following segment of code output? score = 40; if (score > 95) cout << "Congratulations!\n"; cout << "That's a high score!\n"; cout << "This is a test question!" << endl;

That's a high score! This is a test question!

True/False: If you want to stop a loop before it goes through all its iterations, the break statement may be used.

True

True/False: In C++ 11, you cannot use a range-based for loop to modify the contents of an array unless you declare the range variable as a reference.

True

True/False: It is possible for a function to have some parameters with default arguments and some without.

True

True/False: The amount of memory used by an array depends upon the array's data type and the number of elements in the array.

True

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

True

True/False: When you pass an array as an argument to a function, the function can modify the contents of the array.

True

True/False: You should be careful when using the equality operator to compare floating point values because of potential round-off errors.

True

________ functions may have the same name, as long as their parameter lists are different.

Two or more

Which character signifies the beginning of an escape sequence?

\

Which escape sequence causes the cursor to move to the beginning of the current line?

\r

This control sequence is used to skip over to the next horizontal tab stop.

\t

To assign the contents of one array to another, you must use ________.

a loop to assign the elements of one array to the other array

The while loop has two important parts: an expression that is tested for a true or false value, and:

a statement or block that is repeated as long as the expression is true

This statement may be used to stop a loop's current iteration and begin the next one.

continue

This is a variable that is regularly incremented or decremented each time a loop iterates.

counter

The ________ is/are used to display information on the computer's screen.

cout object

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

cstdlib

Which statement allows you to properly check the char variable code to determine whether it is equal to a "C" and then output "This is a check" and then advance to a new line?

if (code == 'C') cout << "This is a check\n";

To read data from a file, you define an object of this data type.

ifstream

The statement: int grades [ ] = { 100, 90, 99, 80 };

implicit array sizing

This means to increase a value by one.

increment

Something within a while loop must eventually cause the condition to become false, or a(n)_________ results.

infinite loop

In a for statement, this expression is executed only once.

initialization

An________ can be used to specify the starting values of an array.

initialization list

Arrays may be ________ at the time they are ________.

initialized, declared

When a program lets the user know that an invalid choice has been made, this is known as:

input validation

Which statement will read an entire line of input into the following string object? string address;

getline(cin, address);

A ________ variable is declared outside all functions.

global

If a function does not have a prototype, default arguments may be specified in the function ________.

header

Which of the following is a valid C++ array definition?

int array[10];

Which of the following is a valid C++ array definition?

int scores [10];

Which of the following correctly consolidates the following declaration statements into one statement? int x = 7; int y = 16; int z = 28;

int x = 7, y = 16, z = 28;

The numeric data types in C++ can be broken into two general categories:

integer and floating point

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

iostream header file

The while loop contains an expression that is tested for a true or false value, and a statement or block that is repeated as long as the expression:

is true

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

left

It is ________ to pass an argument to a function that contains an individual array element, such as numbers[3].

legal in C++

Assume that a program has the following variable definition: char letter; Which of the following statements correctly assigns the character Z to the variable?

letter = 'Z';

This type of variable is defined inside a function and is not accessible outside the function.

local

These operators connect two or more relational expressions into one, or reverse the logic of an expression.

logical

This is a control structure that causes a statement or group of statements to repeat.

loop

The name of an array stores the ________ of the first array element.

memory address

To pass an array as an argument to a function, pass the ________ of the array.

name

When an if statement is placed within the conditionally-executed code of another if statement, this is known as:

nesting

To write data to a file, you define an object of this data type.

ofstream

A two-dimensional array can have elements of ________ data type(s).

one

A function can have zero to many parameters, and it can return this many values.

only one

A file must be ________ before data can be written to or read from it.

opened

Assuming outFile is a file stream object and number is a variable, which statement writes the contents of number to the file associated with outFile?

outFile << number;

This vector function returns the number of elements in a vector.

size

The value in this type of local variable persists between function calls.

static

The value in a ________ variable persists between function calls.

static local

This may be used to write information to a file.

stream insertion operator

The first step in using the string class is to #include the ________ header file.

string

An array of string objects that will hold 5 names would be declared using which statement?

string names[5];

A two-dimensional array of characters can contain ________.

strings of the same length strings of different lengths uninitialized elements

This is a dummy function that is called instead of the actual function it represents.

stub

By using the same ________ you can build relationships between data stored in two or more arrays.

subscript

To access an array element, use the array name and the element's ________.

subscript

This statement uses the value of a variable or expression to determine where the program will branch to.

switch

What is the value of the following expression? false || true

true

What is the value of the following expression? true && true

true

A for statement contains three expressions: initialization, test, and

update

You may define a ________ in the initialization expression of a for loop.

variable

Which statement correctly uses C++ 11 to initialize a vector of ints named n with the values 10 and 20?

vector<int> n { 10, 20 };

Which statement correctly defines a vector object for holding integers?

vector<int> v;

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

x *= 2;

Which of the following expressions will determine whether x is less than or equal to y?

x <= y

If you leave out the size declarator in an array definition:

you must furnish an initialization list

This operator is known as the logical OR operator.

||

Which line in the following program contains the prototype for the showDub function? 1 #include <iostream> 2 using namespace std; 3 4 void showDub (int); 5 6 int main () 7 { 8 int x = 2; 9 10 showDub (x); 11 cout << x << endl; 12 return 0; 13 } 14 15 void showDub (int num) 16 { 17 cout << num * 2 << endl; 18 }

4

What is the output of the following program? #include <iostream> using namespace std; void showDub (int); int main () { int x = 2; showDub (x); cout << x << endl; return 0; } void showDub (int num) { cout << num * 2 << endl; }

4 2

What will the following code display? int number = 6; cout << number++ << endl;

6

For every opening brace in a C++ program, there must be a:

Closing brace

In a C++ program, two slash marks ( // ) indicate:

The beginning of a comment

When writing functions that accept multi-dimensional arrays as arguments, ________ must be explicitly stated in the parameter list.

all but the first dimension

Given that, x = 2, y = 1, and z = 0, what will the following cout statement display? cout << "answer = " << (x || !y && z) << endl;

answer = 1

A(n) ________ is information that is passed to a function, and a(n) ________ is information that is received by a function.

argument, parameter

Unlike regular variables, these can hold multiple values.

arrays

In C++ the = operator indicates:

assignment

The statements in the body of a while loop may never be executed, whereas the statements in the body of a do-while loop will be executed:

at least once

Subscript numbering in C++________.

begins with zero

This statement causes a loop to terminate early.

break

Without this statement appearing in a switch construct, the program "falls through" all of the statements below the one with the matching case expression.

break

A file ________ is a small holding section of memory that file-bound information is first written to.

buffer

Functions are ideal for use in menu-driven programs. When a user selects a menu item, the program can ________ the appropriate function.

call

A function is executed when it is:

called

Which data type typically requires only one byte of storage?

char

If you place a semicolon after the test expression in a while loop, it is assumed to be a(n):

null statement

The ________ is automatically appended to a character array when it is initialized with a string constant.

null terminator

An element of a two-dimensional array is referred to by ________ followed by ________.

the row subscript of the element, the column subscript of the element

An array can store a group of values, but the values must be:

the same data type

The default section of a switch statement performs a similar task as the ________ portion of an if/else if statement.

trailing else

A loop that is inside another loop is called:

a nested loop

An array with no elements is ________.

illegal in C++

This is a pre-test loop that is ideal in situations where you do not want the loop to iterate if the condition is false from the beginning.

while

This operator performs a logical NOT operation.

!

This operator takes an operand and reverses its truth or falsehood.

!

The ________ causes the contents of another file to be inserted into a program.

#include directive

What is the modulus operator?

%

The ________ symbol means "address of."

&

This operator represents the logical AND.

&&

Character constants in C++ are always enclosed in ________.

'single quotation marks'

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

(Parentheses)

The _______ symbol is the dereferencing operator

*

These are operators that add and subtract one from their operands.

++ and --

What is the value of donuts after the following code executes? int donuts = 10; if (donuts = 1) donuts = 0; else donuts += 2;

0

What will the following code display? int numbers[4] = { 99, 87 }; cout << numbers[3] << endl;

0

What will the following loop display? int x = 0; while (x < 5) { cout << x << endl; x++; }

0 1 2 3 4

What will the following program display? #include <iostream> using namespace std; int main() { a = 0, b = 2, x = 4, y = 0; cout << (a==b) << " "; cout << (a!=b) << " "; cout << (b <= x) << " "; cout << (y > a) << endl; return 0; }

0 1 1 0

What is the output of the following code? int w = 98; int x = 99; int y = 0; int z = 1; if (x >= 99) { if (x < 99) cout << y << endl; else cout << z << endl; } else { if ( x == 99) cout << x << endl; else cout << w << endl; }

1

What is the output of the following code segment? n = 1; while (n <= 5) cout << n << ' '; n++;

1 1 1... and on forever

Given the following function definition: void calc (int a, int& b) { int c; c = a + 2; a = a * 3; b = c + a; } What is the output of the following code fragment that invokes calc? int x = 1; int y = 2; int z = 3; calc (x, y); cout << x << " " << y << " " << z << endl;

1 6 3

Which line in the following program contains a call to the showDub function? 1 #include <iostream> 2 using namespace std; 3 4 void showDub (int); 5 6 int main () 7 { 8 int x = 2; 9 10 showDub (x); 11 cout << x << endl; 12 return 0; 13 } 14 15 void showDub (int num) 16 { 17 cout << num * 2 << endl; 18 }

10

How many elements does the following array have? int bugs [1000];

1000

Which line in the following program contains the header for the showDub function? 1 #include <iostream> 2 using namespace std; 3 4 void showDub (int); 5 6 int main () 7 { 8 int x = 2; 9 10 showDub (x); 11 cout << x << endl; 12 return 0; 13 } 14 15 void showDub (int num) 16 { 17 cout << num * 2 << endl; 18 }

15

How many times will the following loop display "Hello"? for (int i = 1; i < 20; i++) cout << "Hello!" << endl;

19

What is the output of the following program? #include <iostream> using namespace std; void doSomething (int&); int main () { int x = 2; cout << x << endl; doSomething (x); cout << x << endl; return 0; } void doSomething (int& num) { num = 0; cout << num << endl; }

2 0 0

What is the output of the following program? #include <iostream> using namespace std; void doSomething (int); int main () { int x = 2; cout << x << endl; doSomething (x); cout << x << endl; return 0; } void doSomething (int num) { num = 0; cout << num << endl; }

2 0 2

How many times will the following loop display "Hello"? for (int i = 0; i < 20; i++) cout << "Hello!" << endl;

20

How many times will the following loop display "Hello"? for (int i = 20; i > 0; i--) cout << "Hello!" << endl;

20

What will be the value of result after the following code has been executed? int a = 60; int b = 15; int result = 10; if (a =b) result *= 2;

20

How many times will the following loop display "Hello"? for (int i = 0; i <= 20; i++) cout << "Hello!" << endl;

21

Given the following code segment, what is output after "result = "? int x = 1, y = 1, z = 1; y = y + z; x = x + y; cout << "result = " << ( x < y ? y : x) << endl;

3

Look at the following function prototype. int myFunction (double, double, double); How many parameter variables does this function have?

3

What will the following code display? int x = 0; for (int count = 0; count < 3; count++) x+= count; cout << x << endl;

3

What will the following C++ 11 code display? vector<int> numbers { 3, 5 }; for (int val : numbers) cout << val << endl;

3 5

Assuming x is 5, y is 6, and z is 8, which of the following is false? 1. x==5; 2. 7 <= (x+2); 3. z <= 4; 4. (1+x) != y; 5. z >= 8; 6. x >= 0; 7. x <= (y*2)

3 and 4 are false.

What is the last legal subscript that can be used with the following array? int values[5];

4

What will the following code display? int number = 6; int x = 0; x = --number; cout << x << endl;

5

What will the following code display? int numbers [ ] = { 99, 87, 66, 55, 101 }; cout << numbers[3] << endl;

55

What will the following code display? int number = 6; int x = 0; x = number--; cout << x << endl;

6

What is the output of the following program? #include <iostream> using namespace std; int getValue (int); int main () { int x = 2; cout << getValue (x) << endl; return 0; } int getValue (int num) { return num + 5; }

7

What will the following code display? int number = 6; cout << ++number << endl;

7

What will the following code display? int number = 6; ++number; cout << number << endl;

7

What will the following code display? int number = 6; number++; cout << number << endl;

7

Which line in the following program will cause a compiler error? 1 #include <iostream> 2 using namespace std; 3 4 int main() 5 { 6 int number = 5; 7 8 if (number >= 0 && <= 100) 9 cout << "passed.\n"; 10 else 11 cout << "failed.\n"; 12 return 0; 13 }

8

What will the following code display? int numbers [ ] = { 99, 87, 66, 55, 101 }; for (int i = 1; i < 4; i++) cout << numbers[i] << endl;

87 66 55

Which value can be entered to cause the following code segment to display the message: "That number is acceptable." int number; cin >> number; if (number > 10 && number < 100) cout << "That number is acceptable.\n"; else cout << "That number is not acceptable.\n";

99

Look at the following statement. while (x++ < 10) Which operator is used first?

<

This operator is used in C++ to represent equality.

==

Which of the following statements about global variables is true?

A global variable can have the same name as a variable that is declared locally within a function.

What will the following code do? const int SIZE = 5; double x[SIZE]; for (int i = 2; i <= SIZE; i++) { x[i] = 0.0; }

An error will occur when the code runs

Input values should always be checked for:

Appropriate range Reasonableness Division by zero, if division is taking place

What will the following segment of code output if the value 11 is entered at the keyboard? int number; cin >> number; if (number > 0) cout << "C++"; else cout << "Soccer"; cout << "is " ; cout << "fun" << endl;

C++ is fun

If you intend to place a block of statements within an if statement, you must place these around the block.

Curly braces { }

True/False: A function's return data type must be the same as the function's parameter(s).

False

True/False: A local variable and a global variable may not have the same name within the same program.

False

True/False: An array initialization list must be placed on one single line.

False

True/False: If you attempt to store data past an array's boundaries, it is guaranteed that the compiler will issue an error.

False

True/False: The default section is required in a switch statement.

False

True/False: The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions.

False

True/False: When a function is called, flow of control moves to the function's prototype.

False

What will the following code display? cout << "Four\n" << "score\n"; cout << "and" << "\nseven"; cout << "\nyears" << " ago" << endl;

Four score and seven years ago

What does the following statement do? vector<int> v(10, 2);

It creates a vector object with a starting size of 10 and all elements are initialized with the value 2. (A.K.A. TURNS THE WHOLE THING PURPLE!)

What does the following statement do? vector<int> v(10);

It creates a vector object with a starting size of 10.

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

Parentheses

A statement that starts with a # symbol is called a:

Preprocessor directive

Whereas < is called a relational operator, x < y is called a(n) ________.

Relational expression

True/False: A parameter is a special-purpose variable that is declared inside the parentheses of a function definition.

True

True/False: An expression that has any value other than 0 is considered true by an if statement.

True

True/False: Both of the following if statements perform the same operation. if ( sales > 10000) commissionRate = 0.15; if (sales > 10000) commissionRate = 0.15;

True

True/False: If the sub-expression on the left side of the || operator is true, the expression on the right side will not be checked.

True

This statement will pause the screen, until the [Enter] key is pressed.

cin.get();

This function tells the cin object to skip one or more characters in the keyboard buffer.

cin.ignore

Assuming dataFile is a file stream object, the statement: dataFile.close();

closes a file

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

cmath

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

cmath

Relational operators allow you to ________ numbers.

compare

Here is the header for a function named computeValue: void computeValue (int value) Which of the following is a valid call to the function?

computeValue(10);

An array's size declarator must be a ________ with a value greater than ________.

constant integer expression, zero

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

fixed

This is a variable, usually a bool or an int, that signals when a condition exists.

flag

This loop is a good choice when you know how many times you want the loop to iterate in advance of entering the loop.

for

An array can easily be stepped through by using a ________.

for loop

To allow file access in a program, you must #include this header file.

fstream

This is a collection of statements that performs a specific task.

function

This is a statement that causes a function to execute.

function call

Every complete C++ program must have a ________.

function named main

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

getline

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

overflows

If a function is called more than once in a program, the values stored in the function's local variables do not ________ between function calls.

persist

This vector function removes an item from a vector.

pop_back

The do-while loop is a(n) ________ loop that is ideal in situations where you always want the loop to iterate at least once.

post-test

The do-while loop is considered a(n) ________ loop.

post-test

The while loop is this type of loop.

pre-test

When the increment operator precedes its operand, as in ++num1, the expression is in this mode.

prefix

This operator increments the value of its operand, then uses the value in context.

prefix increment

A function ________ eliminates the need to place a function definition before all calls to the function.

prototype

This vector function is used to insert an item into a vector.

push_back

The range-based for loop, in C++ 11, is designed to work with a built-in variable known as the ________.

range variable

When used as parameters, these types of variables allow a function to access the parameter's original argument.

reference

This statement causes a function to end.

return

A two-dimensional array can be viewed as ________ and ________.

rows, columns

The ________ of a variable is limited to the block in which it is declared.

scope

Given the following declaration, where is the value 77 stored in the scores array? int scores [ ] = {83, 62, 77, 97};

scores[2]

This is a special value that marks the end of a list of values.

sentinel

A two-dimensional array is like ________ put together.

several identical arrays

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

+

What is the value stored at x, given the statements:

0

What will the following code display? int x = 0, y = 1, z = 2; cout << x << y << z << endl;

012

What is assigned to the variable a given the statement below with the following assumptions: x = 10, y = 7, and z, a, and b are all int variables. a = x >= y;

1

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

12

What is the output of the following segment of code if the value 4 is input by the user when asked to enter a number? int num; int total = 0; cout << "Enter a number from 1 to 10: "; cin >> num; switch (num) { case 1: case 2: total = 5; case 3: total = 10; case 4: total = total + 3; case 8: total = total + 6; default: total = total + 4; } cout << total << endl;

13

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

Look at the following program and answer the question that follows it. 1 // This program displays my gross wages. 2 // I worked 40 hours and I make $20.00 per hour. 3 #include <iostream> 4 using namespace std; 5 6 int main () 7 { 8 int hours 9 double payRate, grossPay; 10 11 hours = 40; 12 payRate = 20.0 13 grossPay = hours * payRate; 14 cout << "My gross pay is $" << grossPay << endl; 15 return 0; 16 } Which line(s) in this program cause output to be displayed on the screen?

14

After execution of the following code, what will be the value of input_value if the value 0 is entered at the keyboard at run time? cin >> input_value; if (input_value > 5) input_value = input_value + 5; else if (input_value > 2) input_value = input_value + 10; else input_value = input_value + 15;

15

What is the value of cookies after the execution of the following statements? int number = 38, children = 4, cookies; cookies = number % children;

2

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

2

What will the value of x be after the following statements execute? int x; x = 18 % 4;

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 number after the following statements execute? int number = 10; number += 5; number -= 2; number *= 3;

39

Which one of the following would be an illegal variable name?

3dGraph

What will the value of x be after the following statements execute? int x; x = 18.0 / 4;

4

What will the value of x be after the following statements execute? int x; x = 18 / 4;

4

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

4.0

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

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 = 77; 7 MY_VAL = 99; 8 cout << MY_VAL << endl; 9 return 0; 10 }

7

Assuming you are using a system with 1-byte characters, how many bytes of memory will the following string literal occupy? "William"

8

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

>>, <<

True/False: Arithmetic operators that share the same precedence have right to left associativity.

False

True/False: The cin << statement will stop reading input when it encounters a newline character.

False

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

False

True/False: The following statement will output $5.00 to the screen: cout << setprecision (5) << dollars << endl;

False

What will be the output of the following code segment after the user enters 0 at the keyboard? int x = -1; cout << "Enter a 0 or 1 from the keyboard: "; cin >> x; if (x) cout << "true" << endl; else cout << "false" << endl;

False

What will the following code display? cout << "Four " << "score "; cout << "and " << "seven/n"; cout << "years" << "ago" << endl;

Four score and seven/nyearsago

What will the following code display? cout << "Four" << "score" << endl; cout << "and " << "seven" << endl; cout << "years" << "ago" << endl;

Fourscore andseven yearsago

Besides decimal, two other number systems you might encounter in C++ programs are:

Hexadecimal and Octal

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

It allows four spaces for the value in the variable num4.

Associativity is either right to left or:

Left to right

These are data items whose values do not change while the program is running.

Literals

What will the following code display? cout << "Monday"; cout << "Tuesday"; cout << "Wednesday";

MondayTuesdayWednesday

The statement: cin >> setw (10) >> str; will read up to this many characters into str.

Nine

In memory, C++ automatically places a ________ at the end of string literals.

Null terminator

This is used to mark the end of a complete C++ programming statement.

Semicolon

In programming terms, a group of characters inside a set of quotation marks is called a(n):

String literal

If you place a semicolon after the statement: if( x < y)

The compiler will interpret the semicolon as a null statement.

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

The data type of the variable

________ must be included in any program that uses the cout object.

The header file iostream

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

The number is number

What is the output of the following code segment? int x =5; if ( x =2) cout << "This is true!" << endl; else cout << "This is false!" << endl; cout << "This is all folks! << endl;

This is true! This is all folks!

True/False: When the fixed manipulator is used, the value specified by the setprecision manipulator will be the number of digits to appear after the decimal point.

True

________ represent storage locations in the computer's memory.

Variables

What will the following segment of code output? Assume the user enters a grade of 90 from the keyboard. cout << "Enter a test score: " << endl; cin >> test_score; if (test_score < 60); cout << "You failed the test!" << endl; if (test_score > 60); cout << "You passed the test!" << endl; else cout << "You need to study for the next test!" << endl;

You failed the test! You passed the test!

In C++ 11, the ________ tells the compiler to determine the variable's data type from the initialization value.

auto key word

A variable whose value can be either true or false is of this data type.

bool

You want the user to enter 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

Assume that a program has the following string object definition: string name; Which of the following statements correctly assigns a string literal to the string object?

name = "Jane";

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

number = number + 1;

A variable's ________ is the part of the program that has access to the variable.

scope

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

A character literal is enclosed in ________ quotation marks, whereas a string literal is enclosed in ________ quotation marks.

single, double

The float data type is considered ________ precision, and the double data type is considered ________ precision.

single, double

This function in C++ allows you to identify how many bytes of storage on your computer system an integer data value requires.

sizeof


Related study sets

Along Niger River/Niger Valley (Jenne-jeno)

View Set

Alterations in Digestive Function

View Set

information of study final exam study guide

View Set

Georgia LAS State Laws and Regulations

View Set

Parrish AP Gov Chapter 10,11,12 Quiz

View Set