Exam 4: Performing Loops

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags
Match each term with the correct statement below.
Premises:
contains sections that initialize, evaluate, and alter a loop control variable
Responses:
while loop
pretest loop
sentinel value
Correct Answer:
Verified
Premises:
Responses:
contains sections that initialize, evaluate, and alter a loop control variable
while loop
Free
(Matching)
4.7/5
(41)
Correct Answer:
Verified

What types of mistakes are easy to make when working with loops?

Free
(Essay)
4.7/5
(26)
Correct Answer:
Verified

Whether you are first learning to use repetition statements or you are an experienced programmer, it is easy to make several types of mistakes:
- Adding an unwanted semicolon
- Forgetting curly braces
- Failing to alter a loop control variable
- Failing to initialize a loop control variable
- Making the same types of mistakes you can make with selections, including forgetting that C++ is case sensitive, assuming indentation has a logical purpose, using = instead of ==, and using the AND operator when you intended to use the OR operator,

The following loop will execute ____ time(s). Number = 1; While(number

Free
(Multiple Choice)
4.8/5
(32)
Correct Answer:
Verified

D

A ____ loop is one that must execute a specific number of times.

(Multiple Choice)
4.9/5
(30)

When you write a loop, what actions must be taken with the loop control variable?

(Essay)
4.7/5
(47)

The segment of code shown below displays "Hello!" ____ times: Int count; Const int NUM_LOOPS = 5; Count = 0; While( count

(Multiple Choice)
4.9/5
(30)

The body of a do-while loop executes ____.

(Multiple Choice)
4.9/5
(33)

What happens if you fail to initialize a loop control variable?

(Essay)
4.8/5
(36)

If you fail to initialize a loop control variable, C++ will automatically assign a value of 0 to the variable.

(True/False)
4.8/5
(42)

In C++, a(n) ____ has an unknown value and is of no practical use.

(Multiple Choice)
4.9/5
(45)

In the following segment of code, Number = 1; While(number The body of the loop is ____.

(Multiple Choice)
4.8/5
(35)

Many programmers recommend that you initialize every variable in your programs.

(True/False)
4.9/5
(40)

A(n) ____________________ loop is one in which the loop control variable is tested after the loop body executes.

(Short Answer)
4.8/5
(32)
Match each term with the correct statement below.
Premises:
contains the statements that execute within a loop
Responses:
loop control variable
while loop
iterator
Correct Answer:
Verified
Premises:
Responses:
contains the statements that execute within a loop
loop control variable
(Matching)
4.7/5
(33)

A loop body can be a single statement or a block of statements.

(True/False)
4.8/5
(32)

In most C++ compilers you can stop an infinite loop from executing by pressing the Ctrl + ____________________ or Ctrl + Break keys.

(Short Answer)
4.8/5
(39)

A loop that completely contains another is a(n) ____ loop.

(Multiple Choice)
4.8/5
(37)

To create a loop that executes at least one time, you should use a ____ loop.

(Multiple Choice)
4.8/5
(40)

Totals are ____________________ by processing individual records one at a time in a loop and adding numeric data to a total.

(Short Answer)
4.8/5
(49)

A priming _________________________ is an input statement that initializes a variable before a loop begins.

(Essay)
4.8/5
(38)
Showing 1 - 20 of 51
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)