CSCE Chapter 4

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

T

(T/F) A conditionally executed statement should be indented one level from the if statement.

F

(T/F) A variable defined in an inner block cannot have the same name as a variable defined in the outer block.

!

The ___ logical operator has higher precedence than the other logical operators.

Local (block)

A variable with ___ scope is only visible when the program is executing in the block containing the variable's definition.

Conditional

An expression using the conditional operator is called a(n) ___ expression.

Relational

An expression using the greater-than, less-than, greater-than-or-equal to operator is called a(n) ___ expression.

Braces

For an if statement to conditionally execute a group of statements, the statements must be enclosed in a set of ___.

&&

If the sub-expression on the left of the ___ logical operator is false, the right sub-expression is not checked.

||

If the sub-expression on the left of the ___ logical operator is true, the right sub-expression is not checked.

||

The ___ logical operator works best when testing a number to determine if it is outside a range.

&&

The ___ logical operator works best when testing a number to determine if it is within a range.

Break statement

The expression following a case statement must be a(n) ___ ___.

Ordinal

The expression that is tested by a switch statement must have a(n) ___ value.

F

x >= y is the same as (x > y && x = y)

T

(T/F) All lines in a block should be indented one level.

F

(T/F) It's safe to assume that all uninitialized variables automatically start with 0 as their value.

F

(T/F) The = operator and the == operator perform the same operation when used in a Boolean expression.

T

(T/F) The scope of a variable is limited to the block in which it is defined.

F

(T/F) When an if statement is nested in the else part of another statement, as in an if/else if, the only time the inner if is executed is when the expression of the outer if is true.

T

(T/F) When an if statement is nested in the if part of another statement , the only time the inner if is executed is when the expression of the outer if is true.

T

(T/F) You can use the relational operators to compare string objects

T

(T/F) x != y is the same as (x > y || x < y)

F

(T/F) y < x is the same as x >= y

Break

A program will "fall through" a case section if it is missing the ___ statement.

True, False

A relational expression is either ___ or ___.

True, True

In an if/else statement, the if part executes its statement or block if the expression is ___, and the else part executes its statement or block if the expression is ___.

True

The if statement regards an expression with a nonzero value as ___.

False

The if statement regards an expression with the value 0 as ___.

Nested

The if/else if statement is actually a form of the ___ if statement.

Left-to-Right

The logical operators have ___ associativity.

Default

The trailing else in an if/else if statement has a similar purpose as the ___ section of a switch statement.

False, True

The value of a relational expression is 0 if the expression is ___ or 1 if the expression is ___.

Relational

You use the ___ operator to determine whether one string object is greater then another string operator.


Conjuntos de estudio relacionados

CPT-264 Systems and Procedures Chapter-1

View Set

Network Troubleshooting and Tools (5.0) study set

View Set

CompTIA A+ Exam 220-1001 - Troubleshooting Quiz

View Set

1st conditional + future time clauses

View Set

WHAP: The Ultimate Guide to World History

View Set