1. List three examples that show when a count-controlled loop is better than condition-controlled loop in programming?
1. It keeps a count of the number of times you want to use the program to input data
2. It only runs as many times as you have instructed the program to run
3. It will stop after the allotted time it has been instructed to
2. List three examples that show when a condition-controlled is better than count-controlled loop in programming?
1. The variable can be more than one number.. as long as the statement is true
2. Condition-controlled will stop so long has reached the directed variable
3. The variables numbers can be any real number which will make the statement true Unit 8 Assignments:
Short Answer:
6. What is an infinite loop?
An infinite loop is a sequence of instructions in a computer program which loops endlessly, either due to the loop having no terminating condition, having one that can never be met, or one that causes the loop to start over. dim x as integer do until x > 5 x = 1 x = x + 1 loop 7. A For loop looks like what other loop in a flowchart?
Step 1 - Is the condition true? Yes or No
Step 2 - If Yes then execute the code and repeat step 1.
If No then don't execute the code and don't repeat step 1. Continue to whatever the next step is.
8. Why is it critical that accumulator variables are properly initialized?
If it isn't, then you don't know for sure what value it will start at in some languages. Your count will be inaccurate. In other languages, it will just generate an error if you forget to initialize.
9. What is the advantage of using a sentinel?
It allows implementation to be shifted from the list to the nodes themselves.
10. Why must the value chosen for use as a sentinel be carefully selected?
The value must be unique enough that it will not be mistaken as a regular value in the list.
Algorith Workbench:
3. Design a For Loop that displays the