Exam 5: Control Structures II Repetition

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

Suppose sum, num, and j are int variables, and the input is 4 7 12 9 -1. What is the output of the following code? Suppose sum, num, and j are int variables, and the input is 4 7 12 9 -1. What is the output of the following code?

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

A

Assume that all variables are properly declared. The following for loop executes 20 times. Assume that all variables are properly declared. The following for loop executes 20 times.

Free
(True/False)
4.8/5
(36)
Correct Answer:
Verified

False

What is the initial statement in the following for loop? (Assume that all variables are properly declared.) What is the initial statement in the following for loop? (Assume that all variables are properly declared.)

Free
(Multiple Choice)
4.9/5
(39)
Correct Answer:
Verified

A

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

(True/False)
4.9/5
(32)

In a while and for loop, the loop condition is evaluated before executing the body of the loop. Therefore, while and for loops are called ____________________ loops.

(Short Answer)
4.7/5
(35)

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

(Multiple Choice)
4.9/5
(38)

Which executes first in a do...while loop?

(Multiple Choice)
4.9/5
(41)

What is the output of the following C++ code? What is the output of the following C++ code?

(Multiple Choice)
4.8/5
(33)

A loop that continues to execute endlessly is called a(n) ____ loop.

(Multiple Choice)
4.9/5
(44)

A semicolon at the end of the for statement (just before the body of the loop) is a(n) ____________________ error.

(Short Answer)
4.8/5
(43)

What is the output of the following C++ code? What is the output of the following C++ code?

(Multiple Choice)
4.7/5
(47)

Consider the following code. This code is an example of a(n) ____ while loop. Consider the following code. This code is an example of a(n) ____ while loop.

(Multiple Choice)
4.8/5
(40)

In ____ structures, the computer repeats particular statements a certain number of times depending on some condition(s).

(Multiple Choice)
4.9/5
(43)

Suppose sum and num are int variables, and the input is 18 25 61 6 -1. What is the output of the following code? Suppose sum and num are int variables, and the input is 18 25 61 6 -1. What is the output of the following code?

(Multiple Choice)
4.8/5
(33)

A(n) ____-controlled while loop uses a bool variable to control the loop.

(Multiple Choice)
4.8/5
(38)

Which of the following statements generates a random number between 0 and 50?

(Multiple Choice)
4.9/5
(37)

____ loops are called posttest loops.

(Multiple Choice)
4.7/5
(38)

The control statements in the for loop include the initial statement, loop condition, and update statement.

(True/False)
4.8/5
(41)

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

(Multiple Choice)
4.9/5
(46)

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
(33)
Showing 1 - 20 of 40
close modal

Filters

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