Quiz #5. - Ch. 4 (Repetition) - [C Programming I]

¡Supera tus tareas y exámenes ahora con Quizwiz!

A post-test loop may never run.

False (Post-test loop always run at least one time (because you have to go through 1 iteration of the loop before you evaluate the condition.)

An infinite loop is a loop that _____.

never ends (A lot of times when a computer appears to be 'hung-up' it is really in an infinite loop.)

Many loops iterate a certain number of times, and during the iterations the loop counter must always count up - counting down is not allowed.

False (And unless the loop counter is declared as unsigned, it can count down past zero (0).)

A loop iteration is one complete cycle through the loop statements.

True (We may call it a cycle, a loop, or an iteration, but it all means the same - one time through a loop's statements.)

The diamond symbol in a flowchart for a loop represents _____.

a Boolean expression that is tested to determine if the loop should iterate (The diamond represents a condition (that evaluates to either True or False) that determines if the loop should run.)

A do-while loop will iterate _____.

as long as its expression is True (Both while loops and do-while loops (as well as for loops) iterate when the condition is True.)

A do-while loop tests the condition _____.

at the bottom of the loop (while loops are pre-test loops, which evaluate the condition at the top of the loop. do-while loops are post-test loops, which evaluate the condition at the bottom of the loop.)

To increment the variable i by 2, use _____.

i += 2; (Increment operators just add 1 to a variable - use a compound statement if you need to add more than 1.)

When you have to write code that performs the same task over and over, you should use a _____ structure.

repetition (Repetition (or looping), along with sequence and decisions, are the 3 main constructs that any program can be written using.)

A while loop _____.

tests its condition at the top of the loop (Pre-test loops (loops with the condition at the top of the loop) may never run due to the condition being evaluated before the loop runs.)


Conjuntos de estudio relacionados

HW: electric charges and coulomb's law

View Set

placenta, umbilical cord, amniotic fluid and membrane pathology

View Set

Chapter 12: Nursing Management During Pregnancy

View Set

Philosophy (THE HUMAN PERSON IN SOCIETY)

View Set

Isosceles Triangles Assignment and Quiz

View Set

Speaking Test (Q&A FH2 Unit 7-12)

View Set