Back to Lesson # 8 - Looping | Table of Contents | # 8 Assignment |
1. Which type of looping construct is the best choice for having the computer calculate grade point averages for students with ID numbers 1000 to 1100?
3. Which of the following is the best choice for asking a user to decide whether they wanted to run a game program again or not?
5. A do {...} while (...) loop will repeat until
6. Some beginning programmers try to check the user's input for validity by using a branching structure. What is the drawback of using an if statement as shown in this example:
... if (badData) userData = prompt("Invalid, Please re-enter your information." ,"");
7. What is the output of this code segment?
var a=10,b=3; while ( a-b < 0 ) { document.write ("I am the greatest!"); a-=b; }
9. What is the output of this code?
var tot = 0;
for (var i = 0; i < 6; i++) {
tot +=i;
}
alert ( "The total is now " + tot );