CSAP FINAL EXAM REVIEW QUESTIONS
AND ANSWERS FALL SERIES.
Which of the following are examples of an indefinite loop?
I. jogging until kids tell you to stop
II. eating 20 chips
III. playing football with your son
Correct Answer -I and III only
Consider the following two algorithms for determining the tallest person in
a group.
Algorithm A
Step 1: Everybody stands and lines up against the wall.
Step 2: One person from those who are standing steps forward.
Step 3: One person from those who are standing steps forward.
Step 4: The shorter of these two people who stepped forward sits down.
Step 5: Repeat steps 3 and 4 until only on person is standing.
Step 6: The last person standing is the tallest in the group.
Algorithm B
Step 1: Everybody stands and lines up against the wall.
Step 2: Each standing person pairs up with one other standing person.
Step 3: The shorter member of each pair sits down.
Step 4: Repeat steps 2 and 3 until only one person is standing.
Step 5: The last person standing is the tallest in the group.
Category | Study Material |
Comments | 0 |
Rating | |
Sales | 0 |