1. By default, the JavaScript sort method uses __________ to sort the array pass
ID: 3537095 • Letter: 1
Question
1. By default, the JavaScript sort method uses __________ to sort the array passed to it. (Points : 6) string comparisonbinary search
linear search
bubble sort
2. The best way to develop and maintain a large program is to construct it from small, simple pieces called __________. (Points : 6) scripts
modules
scriptlets
objects
3. A function that calls itself either directly or indirectly through another function is called a __________ function. (Points : 6) base case
iterative
recursive
fibonacci
4. Which of the following is not required for counter-controlled repetition? (Points : 6) Final value
Initial value
Sentinel
Increment
5. Which of the following statements is correct? (Points : 6) If ( studentGrade >= 60 )
document.writeln( "Passed" );
if ( studentGrade >= 60 );
document.writeln( "Passed" );
if ( studentGrade >= 60 )
document.write( "Passed" );
If ( studentGrade >= 60 );
document.write( "Passed" );
6. What is the value of s3 after the following code is executed?
var s1 = %u201Cone%u201D;
var s2 = %u201Ctwo%u201D;
var s3 = %u201Cthree%u201D;
s1.concat( s2 );
s3 = s1; (Points : 6) one
onetwo
three
onetwothree
7. All variables declared in function definitions are __________. (Points : 6) global variables
local variables
static variables
constant variables
8. What is the result of writing the keyword var in a function parameter list? (Points : 6) The result would be a JavaScript runtime error.
The parameter following the keyword would have global scope.
The parameter following the keyword would have local scope.
The parameter following the keyword would become a static variable.
9. When a function invokes a new copy of itself, it is called a __________. (Points : 6) base case
final step
base case
recursive call
10. To refer to a particular location or element in the array, we specify the name of the array and the __________ of the particular element in the array. (Points : 6) contents
size
position number
type
11. What does the following statement do?
Math.floor( Math.random() * 12 ); (Points : 6) This creates a random number from 0 up to and including 12.
This creates a random number from 0 up to but not including 12.
This creates a random number from 1 up to and including 12.
This creates a random number from 1 up to but not including 12.
12. Pass-by- __________ is the method of passing the argument's address in memory to a function. (Points : 6) value
parameters
memory
reference
13. What is the output of the following script?
i = 16;
document.write( ++i ); (Points : 6) 16
17
15
Nothing; the browser would generate an error.
14. What does the following expression evaluate to?
( ( 3 + ( 5 + 4 ) * 7 ) + 4 ) / 5 (Points : 6) 8
14
17.6
26.4
15. Research determined that all programs could be written in terms of only three control structures. Which of the following is not one of the three control structures? (Points : 6) Goto-less structure
Sequence structure
Selection structure
Repetition structure
16. Which of the following is an illegal array initialization statement? (Points : 6) var n = [ 10, 20, 30, 40, 50 ];
var n = new Array( 10, 20, 30, 40, 50 );
var n[ 10, 20, 30, 40, 50 ];
var n = new Array( 5 );
for ( var i = 1; i <= 5; i++ )
n[ i ] = i * 10 ;
17. What would the browser display if the following script were executed?
<script type = "text/javascript">
<!--
for ( var i = 0; var i < 5; var i++ )
document.write( "X" );
//-->
</script> (Points : 6) Nothing; the script would generate an error
XXXX
XXXXX
XXXXXX
18. A JSON object is represented as a list contained in __________. (Points : 6) curly braces
square brackets
single quotes
double quotes
19. What type of loop should be used in a script that processes test results for 150 students? (Points : 6) counter controlled
sentinel controlled
algorithm controlled
stepwise controlled
20. Which of the following is the proper method to dynamically allocate memory to an array of 100 elements? (Points : 6) var c = new c[ 100 ];
var c = new c( 100 );
var c = new Array[ 100 ];
var c = new Array( 100 );
1. By default, the JavaScript sort method uses __________ to sort the array passed to it. (Points : 6) string comparison
binary search
linear search
bubble sort
2. The best way to develop and maintain a large program is to construct it from small, simple pieces called __________. (Points : 6) scripts
modules
scriptlets
objects
3. A function that calls itself either directly or indirectly through another function is called a __________ function. (Points : 6) base case
iterative
recursive
fibonacci
4. Which of the following is not required for counter-controlled repetition? (Points : 6) Final value
Initial value
Sentinel
Increment
5. Which of the following statements is correct? (Points : 6) If ( studentGrade >= 60 )
document.writeln( "Passed" );
if ( studentGrade >= 60 );
document.writeln( "Passed" );
if ( studentGrade >= 60 )
document.write( "Passed" );
If ( studentGrade >= 60 );
document.write( "Passed" );
6. What is the value of s3 after the following code is executed?
var s1 = %u201Cone%u201D;
var s2 = %u201Ctwo%u201D;
var s3 = %u201Cthree%u201D;
s1.concat( s2 );
s3 = s1; (Points : 6) one
onetwo
three
onetwothree
7. All variables declared in function definitions are __________. (Points : 6) global variables
local variables
static variables
constant variables
8. What is the result of writing the keyword var in a function parameter list? (Points : 6) The result would be a JavaScript runtime error.
The parameter following the keyword would have global scope.
The parameter following the keyword would have local scope.
The parameter following the keyword would become a static variable.
9. When a function invokes a new copy of itself, it is called a __________. (Points : 6) base case
final step
base case
recursive call
10. To refer to a particular location or element in the array, we specify the name of the array and the __________ of the particular element in the array. (Points : 6) contents
size
position number
type
11. What does the following statement do?
Math.floor( Math.random() * 12 ); (Points : 6) This creates a random number from 0 up to and including 12.
This creates a random number from 0 up to but not including 12.
This creates a random number from 1 up to and including 12.
This creates a random number from 1 up to but not including 12.
12. Pass-by- __________ is the method of passing the argument's address in memory to a function. (Points : 6) value
parameters
memory
reference
13. What is the output of the following script?
i = 16;
document.write( ++i ); (Points : 6) 16
17
15
Nothing; the browser would generate an error.
14. What does the following expression evaluate to?
( ( 3 + ( 5 + 4 ) * 7 ) + 4 ) / 5 (Points : 6) 8
14
17.6
26.4
15. Research determined that all programs could be written in terms of only three control structures. Which of the following is not one of the three control structures? (Points : 6) Goto-less structure
Sequence structure
Selection structure
Repetition structure
16. Which of the following is an illegal array initialization statement? (Points : 6) var n = [ 10, 20, 30, 40, 50 ];
var n = new Array( 10, 20, 30, 40, 50 );
var n[ 10, 20, 30, 40, 50 ];
var n = new Array( 5 );
for ( var i = 1; i <= 5; i++ )
n[ i ] = i * 10 ;
17. What would the browser display if the following script were executed?
<script type = "text/javascript">
<!--
for ( var i = 0; var i < 5; var i++ )
document.write( "X" );
//-->
</script> (Points : 6) Nothing; the script would generate an error
XXXX
XXXXX
XXXXXX
18. A JSON object is represented as a list contained in __________. (Points : 6) curly braces
square brackets
single quotes
double quotes
19. What type of loop should be used in a script that processes test results for 150 students? (Points : 6) counter controlled
sentinel controlled
algorithm controlled
stepwise controlled
20. Which of the following is the proper method to dynamically allocate memory to an array of 100 elements? (Points : 6) var c = new c[ 100 ];
var c = new c( 100 );
var c = new Array[ 100 ];
var c = new Array( 100 );
Explanation / Answer
1 bubble sort 2 modules 3 recursive 4 Increment 5 if ( studentGrade >= 60 ) document.write( "Passed" ); 3rd option 6 onetwo 7 local variables 8 The parameter following the keyword would have global scope. 9 recursive call 10. position number (also called index) 11.This creates a random number from 0 up to and including 12. 12 reference 13 17 14. 14 15.Goto-less structure 16 var n[ 10, 20, 30, 40, 50 ]; (there is no assignment operator example: '=') 17 Nothing; the script would generate an error (because the For loop is commented) 18 curly braces 19. algorithm controlled 20 var c = new c( 100 );
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.