1/15
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
8.1 Which of the following is not required for counter-controlled repetition?
a) final value
b) initial value
c) sentinel
d) increment
c
8.2 What should you use as a counter in counter-controlled repetition?
a) a floating-point number
b) a sentinel
c) an integer
d) a num object
c
8.3 What would the browser display if the following script were executed?
a) Nothing; the script would generate an error
b) XXXX
c) XXXXX
d) XXXXXX
a
8.4 What would the browser display if the following script were executed?
a) Nothing; the script would generate an error
b) OOOO
c) OOOOO
d) OOOOOO
c
8.5 Which of the following is declared correctly and will not result in an error, assuming x = 2 and y = 30?
a) for ( var j = 10; j <= 80; j-- )
b) for ( var j = x, j <= y, j += 5 )
c) for ( var j = x; j <= 80 * y; j += 5 / x )
d) for ( var j = x; j <= 80 * y; j -= 5 )
c
8.6 What is the value of num after the following statement is performed?
num = 2 * Math.pow( 2, 3 );
a) 16
b) 18
c) 64
d) 8
a
8.7 What is the value of num after the following statements are performed?
num = 2.4589;
num = num.toFixed( 2 );
a) 2
b) 2.46
c) 2.5
d) 2.45
b
8.8 The ________ multiple-selection statement is used to handle decision making and can be used to replace multiple if and if...else statements.
a) do...while
b) case
c) break
d) switch
d
8.9 switch statements contain ________ labels.
a) select
b) if...else
c) case
d) choice
c
8.10 In a switch statement, the ________ case clause is used to process exceptional conditions and is usually listed last.
a) break
b) default
c) else
d) then
b
8.11 Consider the following code selections. Assume count is initialized to 7 and num is initialized to 0.
i) ii)
do
{ while ( count < 6 )
num = count; num = count;
} while ( count < 6 )
What will the value of num be for i) and ii) respectively after the loops have been executed?
a) 0, 0
b) 0, 7
c) 7, 0
d) 7, 7
c
8.12 What would the browser display if it executed the following script?
a) Nothing; the script would generate an error
b) O
c) OOOOO
d) OOOOOO
b
8.13 What would the browser display if it executed the following script?
a) Nothing; the script would generate an error.
b) 1
c) 5
d) 10
c
8.14 What would the browser display if it executed the following script?
a) Nothing; the script would generate an error.
b) 5
c) 9
d) 10
d
8.15 Which of the following will not evaluate to true?
a) false || false
b) true || true
c) false || true
d) true || false
a
8.16 Which of the following will not evaluate to false?
a) false && false
b) true && true
c) false && true
d) true && false
b