c++ end semester

¡Supera tus tareas y exámenes ahora con Quizwiz!

Putting ____________________ in front of a logical expression reverses the value of that logical expression.

!

Which of the following operators has the highest precedence?

!

Which of the following is the "not equal to" relational operator?

!=

Suppose that x is an int variable. Which of the following expressions always evaluates to true?

(x > 0) || ( x <= 0)

Which of the following expressions correctly determines that x is greater than 10 and less than 20?

10 < x && x < 20

The expression (x >= 0 && x <= 100) evaluates to false if either x < 0 or x >= 100.

False

The result of a logical expression cannot be assigned to an int variable, but it can be assigned to a bool variable.

False

A control structure alters the normal sequential flow of execution in a program.

True

In a counter-controlled while loop, the loop control variable must be initialized before the loop.

True

In the case of the sentinel-controlled while loop, the first item is read before the while loop is entered.

True

Suppose P and Q are logical expressions. The logical expression P && Q is true if both P and Q are true.

True

The ____________________ of relational and logical operators is said to be from left to right.

associatively

The ____ statement can be used to eliminate the use of certain (flag) variables.

break

The ____________________ statement is typically used for two purposes: To exit early from a loop. To skip the remainder of a switch structure.

break

To output results correctly, the switch structure must include a(n) ____________________ statement after each cout statement, except the last cout statement.

break

The expression in an if statement is sometimes called a(n) ____.

decision maker

Which of the following is a repetition structure in C++?

do...while

____ loops are called posttest loops.

do...while

Which of the following loops does not have an entry condition?

do...while loop

In a sentinel-controlled while loop, the body of the loop continues to execute until the EOF symbol is read.

false

Suppose found = true and num = 6. The value of the expression (!found) || (num > 6) is ____________________.

false

The value of the expression 6 < 5 || 'g' > 'a' && 7 < 4 is ____________________.

false

A(n) ____-controlled while loop uses a bool variable to control the loop.

flag

When a continue statement is executed in a ____, the update statement always executes.

for loop

Which of the following will cause a logical error if you are attempting to compare x to 5?

if (x = 5)

A loop that continues to execute endlessly is called a(n) ____ loop.

infinite

A loop ____________________ is a set of statements that remains true each time the loop body is executed.

invariant

The function eof is a member of the data type ____________________.

istream

What does <= mean?

less than or equal to

What executes immediately after a continue statement in a while and do-while loop?

loop-continue test

In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).

looping

When one control statement is located within another, it is said to be ____.

nested

In a while and for loop, the loop condition is evaluated before executing the body of the loop. Therefore, while and for loops are called ____________________ loops.

pretest

In a ____ control structure, the computer executes particular statements depending on some condition(s).

selection

A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____________________ error.

semantic

Putting a semicolon after the parentheses following the expression in an ifstatement (that is, before the statement) is a(n) ____________________ error.

semantic

The term ____________________ describes a process in which the computer evaluates a logical expression from left to right and stops as soon as the value of the expression is known.

short circuit evaluation

Which executes first in a do...while loop?

statement

A compound statement functions as if it was a single statement.

true

In C++, && has a higher precedence than ||.

true

The control statements in the for loop include the initial statement, loop condition, and update statement.

true

The control variable in a flag-controlled while loop is a bool variable.

true

The number of iterations of a counter-controlled loop is known in advance.

true

The value of the expression 7 + 8 <= 15 is ____________________.

true

Which of the following operators has the lowest precedence?

=

In C++, both ! and != are relational operators.

False

The statement in the body of a while loop acts as a decision maker.

False

The operators != and == have the same order of precedence.

True

Once an input stream enters a(n) ____________________ state, all subsequent input statements associated with that input stream are ignored, and the computer continues to execute the program, which produces erroneous results.

fail

In C++, !, &&, and || are called relational operators.

false


Conjuntos de estudio relacionados

soc midterm- Latent Functions of Education

View Set

ENTR 187 - Entrepreneurship - Sac State - Dr. VanVo

View Set

Env Chem - Unit 2 Greenhouse Effect Review

View Set

Chapter 18: Care of Patients with Arthritis and Other Connective Tissue Diseases

View Set

Money & Banking Chapter 5 The Structure of Interest Rates

View Set