Exam 6: Flow of Control, Part 2: Looping

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

The loop continuation condition is the ___________ of the loop termination condition.

Free
(Short Answer)
4.9/5
(39)
Correct Answer:
Verified

opposite

Assuming the for loop header for ( i = 0; i < 20; i++ ), what will be value of i after we exit the loop?

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

C

In a for loop header, statements are separated with:

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

C

What is each execution of the loop body called?

(Multiple Choice)
4.8/5
(33)

When computing the maximum value among a number of values, we should initialize the maximum to 0.

(True/False)
4.8/5
(44)

Using an event-controlled while loop and an accumulation operation to create a calculator, a result that is higher than the correct total occurs because the total variable was not initialized to 0.

(True/False)
4.9/5
(38)

If you want to loop between the values 3 included and 7 excluded, the for loop header would be: for( int count = 3; count < 7; count++ )

(True/False)
4.9/5
(32)

If the while loop condition is false the first time it is evaluated, the number of iterations that will be in the body of the loop is __________.

(Short Answer)
4.8/5
(51)

Calculating an average is a combination of addition and counting.

(True/False)
4.8/5
(35)

A sentinel value in a while loop provides a function similar to which of the following?

(Multiple Choice)
4.7/5
(35)

Writing a String in reverse can be done using a(n) __________.

(Short Answer)
5.0/5
(37)

When you use a while loop to compute the product of several values, you should initialize the variables holding the product to:

(Multiple Choice)
4.8/5
(39)

Without the priming read, the while loop continually processes the same data item, leading to an endless loop.

(True/False)
4.9/5
(44)

When you use a while loop to count how many values meet a certain condition, you should initialize the variable holding the count to:

(Multiple Choice)
4.8/5
(38)

Which of the following arguments constructs a File object with the pathname file name so that the file name is platform independent?

(Multiple Choice)
4.8/5
(34)

It is a good idea to initialize the maximum value to 0 when trying to find maximum values.

(True/False)
4.7/5
(37)

Curly braces around a for loop body are optional if the for loop body consists of only one statement.

(True/False)
4.9/5
(43)

When you use a while loop to compute the average of several integer values, and assuming there is more than one such value, what do you have to worry about when dividing the sum of these values by the number of these values?

(Essay)
4.8/5
(43)

We typically use a for loop as a(n) __________ loop.

(Short Answer)
4.9/5
(47)

Some code is already coded with a for loop. It is possible to rewrite that code using a while loop.

(True/False)
4.8/5
(36)
Showing 1 - 20 of 67
close modal

Filters

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