CS Exam 1

Réussis tes devoirs et examens dès maintenant avec Quizwiz!

The __________ causes the content of another file to be inserted into a program.

#include directive

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 the __________ data type.

ofstream

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;

The do-whileloop is considered

post test loop

The whileloop is a __________ loop.

pretest

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

round(x)

The float data type is considered ___________ precision and the double data type is considered __________ precision.

single, double

To write information to a file, use the

stream insertion operator

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

switch

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

the data type of the variable

A variable definition tells the computer

the variable's name and the type of data it will hold

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

trailing else

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

true

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

type conversion

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

Left

A statement that starts with a hashtag (or pound) symbol (#) is called a

Preprocessor directive

In the following statement, the characters Hello!are a cout << "Hello!"

String Literal

An expression that has any value other than 0 is considered true by an if statement. TF?

T

An initialization expression may be omitted from the for loop if no initialization is required. TF?

T

C++ does not have a built in data type for storing strings of data? TF?

T

Escape sequences are stored internally as a single character? TF?

T

Floating point constants are stored as doubles? TF?

T

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

T

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.? TF?

T

The preprocessor reads a program before it is compiled and only executes those lines beginning with #symbol. TF?

T

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

T

In a for statement, this expression is executed only once

initialization

A for statement contains three expressions

initialization, test, and update

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

input validation

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

integers and floating-point numbers

Data items whose values do not change while the program is running are

literals

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

logical

The conditional operator takes two operands. TF?

F

The preprocessor executes after the compiler. TF?

F

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

F

The __________ loop is a good choice when you do not want the loop to iterate if the condition is false in the beginning.

While

The two important parts of a whileloop are the 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

The statements in the body of a whileloop may never be executed while the statements in the body of a do-whileloop will be executed

at least once

Which data type typically requires only one byte of storage?

char

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

cin.get();

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

cin.ignore

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

cstdlib

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

false

A variable, usually a bool or an int, that signals when a condition exists is known as a(n)

flag

The data type used to declare variables that can hold real numbers is

float

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

for

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

getline(cin, address);

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

ifstream


Ensembles d'études connexes

SERIES 66- EXAMFX- Laws, Regulations, and Guidelines, including Prohibition on Unethical Business Practices

View Set

Arts, A/V Technology & communication Career Cluster Vocabulary

View Set

Spanish Presentation Lionel Messi

View Set

Chapter 10: Concepts of Emergency and Trauma Nursing

View Set

Chapter 1 Multinational Financial Management: An Overview

View Set

ch 8 the formation of public opinion

View Set