c++

Ace your homework & exams now with Quizwiz!

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

setw

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

Input values should always be checked for:

All of these

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

flag

Every complete C++ program must have a ________.

function named main

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

string

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

string

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

switch

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?

%

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)

What is the output of the following code?

1

What will the following program segment display?

1 1

What is the value of donuts after the following code executes?

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?

13

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

==

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

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

Parentheses

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

Relational expression

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

The beginning of a comment

If you place a semicolon after the statement:

The compiler will interpret the semicolon as a null statement.

________ represent storage locations in the computer's memory.

Variables

Which data type typically requires only one byte of storage?

char

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

cin.get(length, width, height);

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

closing brace

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

cstdlib

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

double payCheck;

What is the value of the following expression?

false

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

Assuming x is 5, y is 6, and z is 8, which of the following is false?

3 and 4 are false.

In C++ the = operator indicates:

assignment

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

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

input validation

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

literals

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

logical

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

not compile

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

overflows

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

scope

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

scope

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

trailing else

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

x <= y

When a relational expression is false, it has the value

zero

When a relational expression is false, it has the value ________.

zero

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

The header file iostream


Related study sets

History Monetary and Fiscal Policy

View Set

Ch. 47 Integumentary Dysfunction

View Set

Chapter 1 - Perspectives on Maternal and Child Health Care

View Set

COP3014 - Chapter 7 Multiple Choice

View Set

Probability: Simple and Compound Events

View Set

Chapter 8 Lifting and Moving Patients

View Set