Quiz 6, Chapter 5

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

Assume that all variables are properly declared. The following for loop executes 20 times. for (i = 0; i <= 20; i++) cout << i;

False

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

False

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

False

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

False

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

True

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

True

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

True

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

True

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

True

The number of iterations of a counter-controlled loop is known in advance.

True

Which of the following is a repetition structure in C++?

do...while

____ loops are called posttest loops.

do...while

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

do...while loop

Which of the following loops is guaranteed to execute at least once?

do...while loop

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

indexed

A loop ____________________ is a set of statements that remains true each time the loop body is executed.

invariant

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.

patch

A do...while loop is a(n) ____________________ loop, since the loop condition is evaluated after executing the body of the loop.

posttest

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

semantic

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

srand(time(0)); num = rand() % 50;


संबंधित स्टडी सेट्स

Introduction to Information Technology Study Guide

View Set

Content Area: Health Information Privacy and Security Mock Exam

View Set

ITNW 1358 Chapter 8: TCP/IP Applications

View Set

Chapter 8: Basics of Electricity

View Set

DCF - Child Growth and Development (CGDR)

View Set

Athletic Training Administration Midterm

View Set

Unit 16 Advanced Automatic Controls

View Set