No products in the cart.

C++ Programming Principles and Practices for Scientists and Engineers International Edition 4e Gary J Bronson - Test Bank

C++ Programming Principles and Practices for Scientists and Engineers International Edition 4e Gary J Bronson - Test Bank   Instant Download - Complete Test Bank With Answers     Sample Questions Are Posted Below   Chapter 5: Repetition Statements   TRUE/FALSE   Loop structures can evaluate the condition only at the beginning of the repeating …

$19.99

C++ Programming Principles and Practices for Scientists and Engineers International Edition 4e Gary J Bronson – Test Bank

 

Instant Download – Complete Test Bank With Answers

 

 

Sample Questions Are Posted Below

 

Chapter 5: Repetition Statements

 

TRUE/FALSE

 

  1. Loop structures can evaluate the condition only at the beginning of the repeating section of code.

 

ANS:  F                    PTS:   1                    REF:   236

 

  1. The do while construct is an example of a posttest loop.

 

ANS:  T                    PTS:   1                    REF:   236

 

  1. C++’s for statement is virtually interchangeable with its while statement.

 

ANS:  T                    PTS:   1                    REF:   263

 

  1. Combining interactive data entry with the repetition capabilities of the while statement produces adaptable and powerful programs.

 

ANS:  T                    PTS:   1                    REF:   250

 

  1. As a general rule, the continue statement is less useful than the break statement.

 

ANS:  T                    PTS:   1                    REF:   258

 

  1. The for statement performs the same functions as the while statement, but uses a different form.

 

ANS:  T                    PTS:   1                    REF:   263

 

  1. The construction for ( ; count <= 20 ; ) is invalid.

 

ANS:  F                    PTS:   1                    REF:   265

 

  1. In C++, continue produces the same action for both while and for statements.

 

ANS:  F                    PTS:   1                    REF:   267

 

  1. Entering data interactively in a loop is a general technique that’s applicable to for loops.

 

ANS:  T                    PTS:   1                    REF:   275

 

  1. The do statement is particularly useful in filtering user-entered input and providing data validation checks.

 

ANS:  T                    PTS:   1                    REF:   294

 

MULTIPLE CHOICE

 

  1. A(n) ____ statement both defines the boundaries containing the repeating section of code and controls whether the code will be executed.
a. declaration c. arithmetic
b. selection d. repetition

 

 

ANS:  D                    PTS:   1                    REF:   236

 

  1. Three different forms of repetition statements are provided in C++: while, ____, and do while.
a. for c. switch
b. if-else d. if-else chain

 

 

ANS:  A                    PTS:   1                    REF:   236

 

  1. In a(n) ____ loop, the condition is tested before any statements in the loop are executed.
a. posttest c. prior
b. pretest d. early-test

 

 

ANS:  B                    PTS:   1                    REF:   236

 

  1. Both the ____ and for loop structures are examples of entrance-controlled loops.
a. while c. do while
b. switch d. if-else

 

 

ANS:  A                    PTS:   1                    REF:   236

 

  1. A loop that evaluates a condition at the end of the repeating section of code is referred to as a(n) ____ loop.
a. entrance-controlled c. exit-controlled
b. pretest d. aftertest

 

 

ANS:  C                    PTS:   1                    REF:   236

 

  1. ____ loops always execute the loop statements at least once before the condition is tested.
a. Pretest c. entrance-controlled
b. Posttest d. beforetest

 

 

ANS:  B                    PTS:   1                    REF:   236

 

  1. In a ____ loop, the condition is used to keep track of how many repetitions have occurred.
a. pretest c. variable-condition
b. posttest d. fixed-count

 

 

ANS:  D                    PTS:   1                    REF:   237

 

  1. In C++, a ____ loop is constructed using a while statement.
a. while c. do
b. whereas d. switch

 

 

ANS:  A                    PTS:   1                    REF:   238

 

  1. A(n) ____ loop is a loop that never ends.
a. fixed c. infinite
b. controlled d. finite

 

 

ANS:  C                    PTS:   1                    REF:   241

 

  1. The line total = total + num is an example of a(n) ____ statement.
a. initialization c. accumulating
b. declaration d. definition

 

 

ANS:  C                    PTS:   1                    REF:   253

 

  1. In computer programming, data values used to signal the start or end of a data series are called ____.
a. sentinels c. dummies
b. marks d. interrupts

 

 

ANS:  A                    PTS:   1                    REF:   256

 

  1. A(n) ____ statement forces an immediate exit from the switch, while, for and do-while statements.
a. exit c. stop
b. break d. halt

 

 

ANS:  B                    PTS:   1                    REF:   258

 

  1. When ____ is encountered in a loop, the next iteration of the loop begins immediately.
a. goto c. resume
b. go d. continue

 

 

ANS:  D                    PTS:   1                    REF:   258

 

  1. A semicolon with nothing preceding it is also a valid statement, called the ____ statement.
a. empty c. blank
b. null d. void

 

 

ANS:  B                    PTS:   1                    REF:   259

 

  1. Typically, null statements are used with while or ____ statements.
a. if-else c. for
b. switch d. case

 

 

ANS:  C                    PTS:   1                    REF:   259

 

  1. In C++, a ____ loop is constructed using a for statement.
a. for c. selection
b. time d. switch

 

 

ANS:  A                    PTS:   1                    REF:   263

 

  1. Inside the parentheses of the for statement are three items, separated by ____.
a. dots c. colons
b. commas d. semicolons

 

 

ANS:  D                    PTS:   1                    REF:   263

 

  1. A(n) ____ forces control to be passed to the altering list in a for statement.
a. exit c. interrupt
b. continue d. next

 

 

ANS:  B                    PTS:   1                    REF:   267

 

  1. In Visual Basic and Pascal, the for statement can be used only to construct ____ loops.
a. posttest c. fixed-count
b. exit-controlled d. variable-condition

 

 

ANS:  C                    PTS:   1                    REF:   271

 

  1. A common programming technique is to use a for or ____ loop to cycle through a set of numbers and select numbers meeting one or more criteria.
a. while c. switch
b. if-else d. break

 

 

ANS:  A                    PTS:   1                    REF:   276

 

  1. Values used to control a loop can be set by using ____.
a. variables c. conditional statements
b. constants d. either a or b

 

 

ANS:  D                    PTS:   1                    REF:   280

 

  1. A loop contained within another loop is called a ____ loop.
a. compound c. complex
b. composed d. nested

 

 

ANS:  D                    PTS:   1                    REF:   288

 

  1. Posttest loops can be constructed in C++ using ____ loops.
a. while c. for
b. do while d. if-else chain

 

 

ANS:  B                    PTS:   1                    REF:   292

 

  1. In C++, a posttest loop can be created by using a(n) ____ statement.
a. if c. do
b. case d. for

 

 

ANS:  C                    PTS:   1                    REF:   292

 

  1. The ____ error means the loop executes either one too many or one too few times than was intended.
a. miscalculation c. less-count
b. off by one d. too-many-few

 

 

ANS:  B                    PTS:   1                    REF:   297

 

COMPLETION

 

  1. A(n) _______________ statement defines the boundaries of a repeating section of code and controls whether the code is executed.

 

ANS:  repetition

 

PTS:   1                    REF:   236

 

  1. Entrance-controlled loops are also referred to as ____________________ loops.

 

ANS:  pretest

 

PTS:   1                    REF:   236

 

  1. In a(n) ____________________-condition loop, the tested condition doesn’t depend on a count being reached; instead, it continues until a specified value is encountered.

 

ANS:  variable

 

PTS:   1                    REF:   238

 

  1. C++’s ____________________ statement is virtually interchangeable with its while statement.

 

ANS:  for

 

PTS:   1                    REF:   236

 

  1. A(n) ____________________ loop’s test condition evaluates to a non-zero value on every repetition.

 

ANS:  infinite

 

PTS:   1                    REF:   241

 

  1. In computer programming, a data value used to signal the start or end of a data series is called a(n) ____________________.

 

ANS:  sentinel

 

PTS:   1                    REF:   256

 

  1. The ____________________ statement violates pure structured programming principles because it provides a second, nonstandard exit from a loop.

 

ANS:  break

 

PTS:   1                    REF:   258

 

  1. When a(n) ____________________ statement is encountered in a loop, the next iteration of the loop begins immediately.

 

ANS:  continue

 

PTS:   1                    REF:   258

 

  1. A(n) ____________________ statement is used where a statement is required syntactically, but no action is called for.

 

ANS:  null

 

PTS:   1                    REF:   259

 

  1. Inside the parentheses of the for statement, the ____________________ list provides the increment value that’s added to or subtracted from the counter each time the loop is executed.

 

ANS:  altering

 

PTS:   1                    REF:   263

 

  1. In C++, the ____________________ statement can replace or be replaced by an equivalent while or for statement.

 

ANS:  do

 

PTS:   1                    REF:   294

 

  1. A do while loop is an example of a(n) ____________________-controlled loop.

 

ANS:  exit

 

PTS:   1                    REF:   292

 

  1. The loop created by the statement for (i = 0; i < 59; i++) executes ____________________ times

 

ANS:

59

fifty-nine

fifty nine

 

PTS:   1                    REF:   297

 

  1. The semicolon at the end of the statement for (count = 0; count < 10; count++); is called a(n) ____________________ statement.

 

ANS:  null

 

PTS:   1                    REF:   297

 

  1. A common programming error is omitting the final ____________________ from the do statement.

 

ANS:

semicolon

;

 

PTS:   1                    REF:   298

Additional information

Add Review

Your email address will not be published. Required fields are marked *