
Signature ____________________ Name _____________________
cs3wb_____
Student ID ___________________ Score:
Quiz 5
CSE 3
Winter 2007
Circle the correct answer.
1. If we want to cycle/loop through an array of 10 elements such that when we get to the end we start
indexing back at the beginning of the array again, we would use which expression to set the index
variable each time in the loop:
A. index = (index + 1);
B. index = 0;
C. index = (index + 1) % 10;
D. index = (index + 1) / 10;
2. In a
setTimeout( "spinWheel1()", duration);
call, the duration units is:
A. milliseconds
B. seconds
C. minutes
D. hours
3. What color is #424242:
A. universal
B. dark gray
C. light gray
D. translucent
4. Which of the following is true:
A. an example of analog is a wave form
B. an example of digital is a CD
C. an example of analog is the output of a stereo speaker
D. all the above
5. Which of the following iterates 10 times?
A.
for (i = 1; i < 10; i = i + 1)
B.
for (i = 0; i < 10; i = i + 1)
C.
for (i = 10; i >= 0; i = i - 1)
D. all of the above
6. The index of the last element in an array that has n elements is:
A. (n + 1)
B. (n โ 1)
C. n
D. (n % 1)
(Over)