COP 3014- Chapter 5 T/F

Ace your homework & exams now with Quizwiz!

A while loop is somewhat limited because the counter can only be incremented by one each time through the loop.

False

The condition that is tested by a while loop must be enclosed in parentheses and terminated with a semicolon.

False

The increment and decrement operators can be used in mathematical expressions; however, they cannot be used in relational expressions.

False

The scope of a variable declared in a for loop's initialization expression always extends beyond the body of the loop.

False

You may nest while and do-while loops but you may not nest for loops.

False

You may not use both break and continue statements within the same set of nested loops.

False

You may not use the break statement in a nested loop.

False

A while loop's body can contain multiple statements, as long as they are enclosed in braces.

True

An initialization expression may be omitted from the for loop if no initialization is required.

True

An output file is a file that data is written to.

True

If you want to stop a loop before it goes through all of its iterations, the break statement may be used.

True

In C++ 11 you can pass a string object as an argument to a file stream object's open member function.

True

It is possible to define a file stream object and open a file in one statement.

True

Multiple relational expressions cannot be placed into the test condition of a for loop.

True

The update expression of a for loop can contain more than one statement, for example: for(i = 5; i <= 10; i++, total+= sales)

True

string objects have a member function named c_str that returns the contents of the object formatted as a null-terminated C-string.

True


Related study sets

Pathopharmacology 1: Musculoskeletal System (University of Toledo)

View Set

Ch 23: Management of Patients with Lower Respiratory Tract Disorders,

View Set

4.1 Furthering Your Customer Service Skills

View Set

Depth of Field and Camera Lenses

View Set

Beneficiaries & Settlement Options Review

View Set

The Behavioural Approach to Explaing Phobias

View Set