Question: Advanced struc Prog with C++ ELET 422-02 Due: 04/03/2017 Chapter 5: Control Statements. Part 2: Logical Operators Section 5.2 Essentials of Counter-Controlled Iteration 1. Which
Advanced struc Prog with C++ ELET 422-02 Due: 04/03/2017 Chapter 5: Control Statements. Part 2: Logical Operators Section 5.2 Essentials of Counter-Controlled Iteration 1. Which of the following does counter-controlled iteration require? a. An initial value b. A condition that tests for the final value. c. An increment or decrement by which the control variable is modified each time through the loop. d. All of the above. 2. Which of the following is a poor programming practice? a. Indenting the statements in the body of each control structure. b. Using floating-point values for counters in counter-controlled iteration. c. Nesting multiple iteration structures. d. Placing vertical spacing above and below control structures. Section 5.3 for Iteration Statement 3. If a variable is declared in the initialization expression of a for statement, then: a. It is automatically reinitialized to zero once the loop is finished. b. The scope of the variable is restricted to that for loop. c. It retains its final value after the loop is finished. d. It can not be used in any structures that are nested in that for structure. 4. Which of the following is false? a. The three expressions in the for structure are optional. b. The initialization and increment expressions can be comma-separated lists. c. You must declare the control variable outside of the for loop, d. A for loop can always be used to replace a while loop, and vice versa. 5. Consider the execution of the following for loop for (int x 1: x 5; increment) cout x 1 endl; If the last value printed is 5, which ofthe following might have been used for increment? a. X++ d. Any of the above. Section 5.4 Examples Using the for Statement 6. Which of the following for headers produces the values from 27 through 3. decrementing by 3? a. for (unsigned int i(27); i 3: i 3) b, for (unsigned int i 27); i 3: i 3) c. for (unsigned int i127h: i 3: i 3) d. All of the above. 1 of 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
