9781111969752_TB_ch05 - Chapter 5 Looping TRUE/FALSE 1 The...

Info icon This preview shows pages 1–3. Sign up to view the full content.

Chapter 5: Looping TRUE/FALSE 1. The loop control variable is initialized after entering the loop. ANS: F PTS: 1 REF: 171 2. In some cases, a loop control variable does not have to be initialized. ANS: F PTS: 1 REF: 171 3. An indefinite loop is a loop that never stops. ANS: F PTS: 1 REF: 173 4. You can either increment or decrement the loop control variable. ANS: T PTS: 1 REF: 173 5. When one loop appears inside another is is called an indented loop. ANS: F PTS: 1 REF: 177 6. Forgetting to initialize and alter the loop control variable is a common mistake that programmers sometimes make. ANS: T PTS: 1 REF: 183 7. Every high-level computer programming language contains a while statement. ANS: T PTS: 1 REF: 192 8. Both the while loop and the for loop are examples of pretest loops. ANS: T PTS: 1 REF: 193 9. The safest action is to assign the value 1 to accumulators before using them. ANS: F PTS: 1 REF: 197 10. It is the programmer’s responsibility to initialize all variables that must start with a specific value. ANS: T PTS: 1 REF: 198 MULTIPLE CHOICE 1. The first step in a while loop is typically to ____. a. compare the loop control variable to a constant value b. initialize the loop control variable c. increment the loop control variable d. execute the body of the loop
Image of page 1

Info icon This preview has intentionally blurred sections. Sign up to view the full version.

ANS: B PTS: 1 REF: 171 2. Once your logic enters the body of a structured loop, ____. a. the entire loop must execute b. the loop can be terminated with a break statement c. the loop will execute indefinitely d. a decision statement will be evaluated ANS: A PTS: 1 REF: 171-172 3. The last step in a while loop is usually to ____. 4. A(n) ____ loop executes a predetermined number of times. 5. Many loop control variable values are altered by ____, or adding to them. 6. A(n) ____ is any numeric variable you use to count the number of times an event has occurred. a. accumulator c. index b. key d. counter ANS: D PTS: 1 REF: 173
Image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.
  • Fall '15
  • loop, loop control, c. posttest loop, c. Nested loop

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern