Professional Documents
Culture Documents
Test Bank For Introduction To Javascript Programming With XML and PHP 0133068307
Test Bank For Introduction To Javascript Programming With XML and PHP 0133068307
MULTIPLE CHOICE
a. parseInt(num) b. Math.round(num)
c. Math.floor(num) d. Math.ceil(num)
ANS: D
function itLoops()
{
var m = 0; var k = 0; var p = 0;
while (m < 3)
{
k = m;
for (p = 1; p < 6; p+=3)
{
k = k + p;
document.write(k + " ");
}
document.write("<br />");
m++;
}
}
a. 1 5 b. 0 4 c. 1 5 d. 2 6
2 6 1 5 2 6 3 7
3 7 2 6 3 7
4 8
ANS: A
5. Which of the following will sum up all the integers between 1 and 10, inclusive?
teabags = teabags % 2;
a. true b. false c. 0 d. 1
ANS: D
a. true b. false c. 47 d. 48
ANS: D
8. What will the value of average be after the given code is executed?
a. 5 b. 9 c. 3 d. 4.78
© 2014 Pearson Education 2
Introduction to JavaScript Programming Test Bank Chapter 5
with XML and PHP
ANS: C
9. What is the value of sum at the end of the given code snippet?
a. 9 b. 5 c. 14 d. 12
ANS: A
10. What is the value of num at the end of the given code snippet?
a. 4 b. 5 c. 6 d. 2
ANS: B
11. Which correctly identifies an even integer, given a numeric variable named num?
ANS: D
12. Which of the following would be used to check if a number stored in a variable named eights is
divisible by 8?
ANS: D
a. 0, 1, 2, or 3 b. 0, 1, 2, 3, or 4
c. 1, 2, 3, or 4 d. 1, 2, 3, 4, or 5
ANS: A
a. cat.jpg b. dog.jpg
c. photo d. cannot tell
ANS: B
a. click the dog image b. move your mouse off the dog image
c. roll your mouse over the dog image d. the image of the cat is already displayed so
nothing needs to be done
ANS: C
16. Which of the following will create a rectangular block of symbols (#'s) with 3 rows and 4 symbols in
each row?
ANS: B
TRUE/FALSE
1. True/False: The break statement allows you to skip one iteration in a loop.
ANS: F
2. True/False: The continue statement is used to skip all or part of a loop iteration and then finishes
the rest of the loop's iterations.
ANS: T
3. True/False: The following code will accurately find the average of four numbers entered by the user:
var sum = 0;
© 2014 Pearson Education 4
Test Bank for Introduction to JavaScript Programming with XML and PHP : 0133068307
4. True/False: Desk checking is only used to check the results of summing or averaging values.
ANS: F
5. True/False: The accumulator is the variable that holds the total of a sum of values in a loop.
ANS: T
7. True/False: The onmouseover event can only be used to swap one image for another.
ANS: F
10. True/False: Selection structures can be nested inside a loop but a loop cannot be nested in a
selection structure.
ANS: F