PDA

View Full Version : For loops and repetition


andyhaus1057
Aug 8, 2009, 12:04 PM
Hi, I'm not sure of these.. Can you please help?


1) The For loop is a ___ type of loop

a) pretest
b) posttest B?
c) prequalified
d) post iterative


2) Each repetition of a loop is known as a(n)

a) cycle
b) revolution
c) orbit
d) iteration D?

Dizzy49
Sep 2, 2009, 11:09 PM
Doing homework? You know it would take you less time to look the information up in your book/notes than it would to write that, and wait for an answer. An answer that will never come because no one is going to do your homework for you.

patilrok
Sep 4, 2009, 03:33 AM
1) ANS is d
2) ANS is d

AngieT.
Jul 28, 2010, 11:07 AM
Thanks Andy. I appreciate your asking this question. PARTICULARLY since it is NEITHER a) listed in our book, or b) in my copious notes. Thanks for asking the question that I needed the answer to.

jaf7081
Oct 23, 2010, 11:55 AM
I am using "Programming an Logic Design" second edition by Tony Gaddis. Since your questions are worded the Same way as mine, we may be using the same book. If so, I too could not find the answer to 1) but the answer to 2) is found at the top of page 68.

cdcochrane
Nov 11, 2010, 05:18 PM
Yes. The book does not specifically say that "The FOR loop is a post iterative loop." Instead, it is more of a comprehession and application question. Answering this question requires the student to derive what type of loop it is. Since we know that the 'FOR' statement is a count-controlled loop, and count-controlled loops repeat a specific number of times (each repetition of a loop is known as an iteration), and we also know that the 'DO WHILE' loop is a posttest loop: we can then determine that the 'FOR' statement will initialize, test, and increment the counter variable. So... it tests something after and initializaion has taken place (posttest) and it repeats itself by the specifications of the counter variable , we can determine that it is a POST ITERATIVE loop.

I have the same book and could not understand why the 'FOR' loop defenition wouldn't be directly referred to as a post iterative loop. I turned to Google and found this site. So I figured I would add to the answers with the reasoning behind the question and answer. I hope this helps. Please feel free to add to this post.