Chapter 5 Quiz Starting Out With C++ 011

The _____ is pretest loop and the _____ is a posttest loop

a. do-while loop, while loop
b. while loop, do-while loop
c. repeat loop, while loop
d. while loop, repeat loop

Chapter 5 Quiz Starting Out With C++ 010

The while loop is usually used when you know the exact number of times a loop will repeat

a. true
b. false

Chapter 5 Quiz Starting Out With C++ 009

What is the format of the while loop in C++?

a.

while ( x >5)
do {
   y++;
}

b.

perform 
{
   y++;
} while (x >5)

c.

while (x >5)
{
   y++;
}

Chapter 5 Quiz Starting Out With C++ 008

A _____ is a part of a program that repeats

a. function
b. loop
c. repeat
d. branch statement

Chapter 5 Quiz Starting Out With C++ 007

Can you use increment or decrement in relationship expressions?

if (x++ > 10)
  cout << "Thanks for playing!";

a. true
b. false

Chapter 5 Quiz Starting Out With C++ 006

Given that x is 5 and y is 4 what will this code segment produce

z = ++(x + y);

a. 11
b. 10
c. a syntax error
d. a compilation error