Filters
Question type

Study Flashcards

To use files in a C++ program you must include the header file.


A) fstream
B) iostream
C) file
D) Both A and B are needed.
E) Both B and C are needed.

Correct Answer

verifed

verified

The do- while loop is a(n) loop, whereas the while loop is a(n) loop.


A) post test, pretest
B) infinite, finite
C) simple, complex
D) pretest, post test
E) finite, infinite

Correct Answer

verifed

verified

In order for a C++ program to read data from a file,


A) the program must open the file.
B) the file must already exist.
C) the program must define a file stream object that can "point to" (i.e., reference) the file.
D) All of the above are required..

Correct Answer

verifed

verified

You can nest a for loop inside another for loop, but cannot nest a while loop inside another while loop or a do-while loop inside another do-while loop.

Correct Answer

verifed

verified

A(n) is a variable that controls the number of times a loop iterates.


A) total
B) accumulator
C) sentinel
D) counter
E) loop control variable

Correct Answer

verifed

verified

If nothing within a while loop ever causes the condition to become false, a(n) may occur.


A) infinite loop
B) null value
C) compiler error
D) unexpected exit
E) system crash

Correct Answer

verifed

verified

A variable that keeps a running total of data values is called a(n)


A) sum.
B) loop control variable.
C) total.
D) accumulator.
E) counter.

Correct Answer

verifed

verified

The statements in the body of a do-while loop are executed


A) only if the test condition is initially true.
B) forever until the user hits the break key.
C) at least once.
D) until the test condition becomes true.
E) until an exit statement is encountered.

Correct Answer

verifed

verified

A for loop is considered a(n) _ loop.


A) infinite
B) pretest
C) sentinel controlled
D) multi test
E) post test

Correct Answer

verifed

verified

When a loop is nested inside another loop, the inner loop goes through all its iterations for each iteration of the outer loop.

Correct Answer

verifed

verified

A(n) is a special value that marks the end of a list of values.


A) counter
B) loop control variable
C) accumulator
D) sentinel
E) total

Correct Answer

verifed

verified

The statements in the body of a do-while loop are executed


A) forever until the user hits the break key.
B) exactly once.
C) until the test condition becomes true.
D) at least once.
E) only if the test condition is initially true.

Correct Answer

verifed

verified

If a while loop has no braces around the body of the loop


A) the loop body contains just one statement.
B) there is no loop body.
C) the loop body ends when the endwhile statement is encountered.
D) the program will not compile.
E) the program will compile, but not run.

Correct Answer

verifed

verified

The while loop is a(n) loop, whereas the do-while loop is a(n) loop.


A) simple, complex
B) finite, infinite
C) post test, pretest
D) pretest, post test
E) infinite, finite

Correct Answer

verifed

verified

A for statement contains three expressions: initialization, test, and


A) update.
B) increment.
C) repeat.
D) quit.
E) validate.

Correct Answer

verifed

verified

The block of code in the body of a while statement can contain an unlimited number of statements, provided they are enclosed in a set of braces.

Correct Answer

verifed

verified

To use files in a C++ program you must include the header file.


A) file
B) iostream
C) fstream
D) Both A and B.
E) Both B and C.

Correct Answer

verifed

verified

The -- operator


A) subtracts one from the value of its operand.
B) must have an lvalue, such as a variable, as its operand.
C) can be used in either prefix or postfix mode.
D) is a unary operator.
E) All of the above are true.

Correct Answer

verifed

verified

Showing 21 - 38 of 38

Related Exams

Show Answer