Computer Science Chapter 4 and 5 True or False

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

False

The do while loop is a pretest loop

True

The for loop is a posttest loop

False

A variable defined in an inner block may not have the same name as a variable defined in the outer block

True

A variable may be defined in the initialization expression of a for loop

True

All lines in a block should be indented one level

True

In a nested loop, the break statement only interrupts the loop it is placed in

True

In a nested loop, the inner loop goes through all of its iterations for every single iteration of the outer loop

False

The = operator and the == operator perform the same operation when used in a Boolean expression

False

The break statement causes a loop to stop the current iteration and begin the next one

False

The cout statement in the following program segment will display 5: int x = 5; cout << ++x

True

The cout statement in the following program segment will display 5: int x = 5; cout << x++;

True

Variables may be defined inside the body of a loop

True

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

True

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

True

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

False

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

False

y < x is the same as x >=y

True

A conditionally executed statement should be indented one level from the if statement

False

It is not necessary to initialize counter variables

False

It's safe to assume that all uninitialized variables automatically start with 0 as their value

False

One limitation of the for loop is that only one variable may be initialized in the initialization expression

False

The operand of the increment and decrement operators can be any valid mathematical expression

True

The scope of a variable is limited to the block in which it is defined

True

The while loop is a pretest loop

True

You can use the relational operators to compare string objects


Conjuntos de estudio relacionados

BADM 371 Chapter 4: Managing Decision Making

View Set

Philosophy of Critical thinking part 2: Psychological Impediments and Language

View Set

Lesson 69 Test 7 Ch 8 abeka 5th grade history

View Set

AP Statistics Semester 2 Quiz/Checkpoint Questions

View Set

CISM - Information Security Governance, Strategy, Objectives & Metrics

View Set

Chapter 12 - Psychological Disorders

View Set

Chpt. 4: Business Ethics & Corporate Social Responsibility

View Set