Exam 5: Control Structures II (Repetition)

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

The ____________________ loop has an exit condition but no entry condition.

(Short Answer)
4.7/5
(34)

Assume all variables are properly declared.The output of the following C++ code is 2 3 4 5. n = 1; while (n < 5) { \quad n++; \quad cout << n << " "; }

(True/False)
4.8/5
(37)

The function srand takes as input a(n)____________________ int,which acts as the seed for the algorithm.

(Short Answer)
4.9/5
(31)

The control variable in a flag-controlled while loop is a bool variable.

(True/False)
4.8/5
(39)

A software ____________________ is a piece of code written on top of an existing piece of code intended to fix a bug in the original code.

(Short Answer)
4.8/5
(40)

In a counter-controlled while loop,the loop control variable must be initialized before the loop.

(True/False)
4.9/5
(35)

The ____________________ statement is typically used for two purposes: • To exit early from a loop. • To skip the remainder of a switch structure.

(Short Answer)
4.9/5
(38)

In a sentinel-controlled while loop,the body of the loop continues to execute until the EOF symbol is read.

(True/False)
4.8/5
(34)

A for loop is typically called a counted or ____________________ for loop.

(Short Answer)
4.8/5
(37)

What is the output of the following loop? count = 5; cout << 'St'; do { \quad cout << 'o'; \quad count--; } while (count <= 5);

(Multiple Choice)
4.9/5
(26)

In the case of the sentinel-controlled while loop,the first item is read before the while loop is entered.

(True/False)
4.9/5
(42)

The following while loop terminates when j > 20. j = 0; while (j < 20) j++;

(True/False)
4.8/5
(44)

Which of the following loops does not have an entry condition?

(Multiple Choice)
5.0/5
(37)

When a continue statement is executed in a ____,the update statement always executes.

(Multiple Choice)
4.9/5
(39)

Consider the following code.(Assume that all variables are properly declared.) cin >> ch; While (cin) { \quad cout << ch; \quad cin >> ch; } This code is an example of a(n)____ while loop.

(Multiple Choice)
4.8/5
(38)

What is the output of the following C++ code? num = 100; while (num <= 150) \quad num = num + 5; cout << num << endl;

(Multiple Choice)
4.7/5
(43)

If a(n)____________________ statement is placed in a do...while structure,the loop-continue test is evaluated immediately after this statement.

(Short Answer)
4.9/5
(34)

The statement in the body of a while loop acts as a decision maker.

(True/False)
4.9/5
(36)

In a(n)"____________________" problem,either the loop executes one too many or one too few times.

(Short Answer)
4.8/5
(43)

The ____ statement can be used to eliminate the use of certain (flag)variables.

(Multiple Choice)
5.0/5
(33)
Showing 21 - 40 of 50
close modal

Filters

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