Loops in ActionScript3

Self Test

Think of the answer to each question, then hold the mouse over the answer button to see the answer.

1. The example below is a ____ loop
num=0; while(num!=5) num+=2; endless, num will be 0, 2, 4, 6, and never 5

2. What is shown by for(n=6;n<2;n-=3) trace(n);

3. What is shown by n=9; do {trace(n); n+=2; } while(n<14); 9, 11, 13,

4. What is shown by for(n=10;n<19;n+=3) trace(n); 10, 13, 16,

5. What is shown by for(n=8;n<14;n+=1) trace(n); 8, 9, 10, 11, 12, 13,

6. What is shown by for(n=1;n>10;n-=1) trace(n); nothing, the condition was false at the beginning

7. While loops and for loops execute _____ times. 0 or more

8. What is shown by n=10; do {trace(n); n+=3; } while(n<18); 10, 13, 16,

9. A loop that always executes at least once is a ____ loop do

10. What is shown by n=6; do {trace(n); n+=1; } while(n<16); 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,

11. What is shown by for(n=1;n<7;n+=3) trace(n); 1, 4,

12. What is shown by n=7; do {trace(n); n+=2; } while(n<7);

13. What is shown by for(n=4;n>4;n-=1) trace(n); nothing, the condition was false at the beginning

14. What is shown by n=6; do {trace(n); n+=2; } while(n<16); 6, 8, 10, 12, 14,

15. What is shown by for(n=2;n<1;n-=1) trace(n);

16. What is shown by n=8; do {trace(n); n+=2; } while(n<10); 8,

17. What is shown by for(n=8;n>6;n-=1) trace(n); 8, 7,

18. What is shown by n=2; do {trace(n); n+=2; } while(n<5); 2, 4,

19. What is shown by for(n=3;n>5;n-=1) trace(n); nothing, the condition was false at the beginning

20. What is shown by n=2; do {trace(n); n+=2; } while(n<2);

LESSON

INDEX


Copyright © Hello World Publications. All rights reserved worldwide.

hello-world.com
Privacy
Policy

Site map

Hello-World

7990907625