CMSY 141 - Chapter 4

Ace your homework & exams now with Quizwiz!

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

True

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

flag

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

logical

If you place a semicolon after the statement: if (x < y); the compiler will interpret the semicolon as a

null statement

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

relational expression

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

switch

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

trailing else

This operator represents the logical AND

&&

The value of result in the following expression will be 0 if x has the value of 12. result = x > 100 ? 0 : 1;

False

Relational operators allow you to ________ numbers

compare

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

false

This operator takes an operand and reverses its truth or falsehood

!

If the expression on the left side of the following is false, the expression on the right side will not be checked. (a > = b) && (c == d)

True

If the expression on the left side of the following is true, the expression on the right side will not be checked.

True

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 an if statement is placed within the conditionally-executed code of another if statement, this is known as

nesting

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

true

When a relational expression is FALSE, it has the value

0

The ________ is an equality (or comparison) operator

==

The default section is required in a switch statement.

False

As a rule of style, when writing an if statement you should indent the conditionally-executed statements.

True

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

true

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

true

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

validation

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

{}

The conditional operator takes two operands.

False

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

True

This operator represents the logical OR

||

Which of the following is evaluated first, given the expression: A && B || C && !D

!D


Related study sets

Fahmy 3030 Langenscheidt Grundwortschatz Englisch Teil 1

View Set

Real Estate Prep Agent - Transfer of Property Capture

View Set

ATI Science 1 Human Anatomy and Physiology

View Set

Chapter 13: Green & White-Collar Crimes

View Set

Advanced Computer Architecture - Exam 3

View Set

Chp 40 PrepU -Fluid, Electrolyte, and Acid-Base Balance

View Set