Which of the following is an illegal array initialization statement?
Front
var n[ 10, 20, 30, 40, 50 ];
Back
What does the variable string contain after the following code is executed?
var string = "Good luck on the test";
string = string.charAt( 3 );
Front
d
Back
The style of programming in which the user interacts with a GUI component is called ________ programming.
Front
event-driven
Back
Which of the following is not a global function?
Front
square
Back
What is the result of writing the keyword var in a function parameter list?
Front
The result would be a JavaScript runtime error
Back
A function's ________ are also considered to be local variables.
Front
parameters
Back
Which of the following is the proper method to dynamically allocate memory to an array of 100 elements?
Front
var c = new Array( 100 );
Back
Which of the following are valid names of scopes in JavaScript?
Front
Both local and global
Back
What will the browser display if the following script is executed?
<script type = "text/javascript">
<!--
var theArray = [ 1, 2, 3, 4, 5, 6, 7, 8, 9 ];
modifyArray( theArray[ 3 ] );
document.write( theArray.join( " " ) );
function modifyArray( i )
{
i = 11;
}
//-->
</script>
Front
1 2 3 4 5 6 7 8 9
Back
What does the following statement do?
Math.floor( Math.random() * 12 );
Front
This creates a random number from 0 up to but not including 12
Back
In JavaScript, all objects and arrays are passed to functions by ________.
Front
reference
Back
Which of the following methods would you use to search a string for a specific character?
Front
charAt
Back
Which of the following is a legal function call for the function definition provided below?
function square( y )
{
return y * y;
}
Front
square (7+2);
Back
Pass-by- ________ is the method of passing a copy of the argument's value to a function.
Front
value
Back
Functions that are not provided as part of the JavaScript language are called ____ functions.
Front
programmer-defined
Back
What would the browser output if the following script is executed?
<script type = "text/javascript">
<!--
var array = [ [ 1, 2, 3 ], [ 1, 2, 3 ] ];
for ( var i in array )
{
for ( var j in array[ i ] )
document.write( array[ i ][ j ] + " " );
document.writeln("<br />");
}
//-->
</script>
Front
1 2 3
1 2 3
Back
Change an image's ________ attribute to change which picture it displays.
Front
src
Back
What does the variable string contain after the following code is executed?
var string = "Good luck on the test";
string = string.split( " " );
Front
an array containing the strings "Good", "luck", "on", "the" and "test"
Back
Nested in the audio element are two ________ specifying the locations of the audio clip in MP3 and OGG formats, respectively.
Front
sources elements
Back
Iteration uses ________ statements and recursion uses ________ statements.
Front
repetition, selection
Back
A function that calls itself either directly or indirectly through another function is called a ________ function.
Front
recursive
Back
Giving a local function variable the same name as a global variable will result in which of the following?
Front
The local variable will "hide" the global variable.
Back
The technique of developing and maintaining a large program by constructing it from small, simple pieces is called ________.
Front
divide and conquer
Back
An object's methods are accessed by writing the name of the object immediately followed by a ________.
Front
dot
Back
Which of the following is a mathematical constant?
Front
Math.LN10
Back
Which of the following is the proper method to access the length of the array arr?
Front
arr.length
Back
When does a recursive program go into infinite recursion?
Front
if the recursion step does not converge on the base case
Back
What would the function cube return, assuming it is called with the statement cube( 3 )?
function cube( y );
{
return y y y;
}
Front
JavaScript runtime error
Back
What is the effect of the join statement in the following code?
var theArray1 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
var theArray2 = [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ];
var value = theArray1.join( " " );
Front
The join method will create a string from the values in theArray1
Back
What is the value of s3 after the following code is executed?
var s1 = "one";
var s2 = "two";
var s3 = "three";
s1.concat( s2 );
s3 = s1;
Front
onetwo
Back
If the HTML5 form game has a text field named point in it, what is the proper way to set the text associated with point to 10?
Front
game.point.value = "10"
Back
By default, the JavaScript sort method uses ________ to sort the array passed to it.
Front
string comparison
Back
The value a in the following statement is called the ________ and the value b is called the ________.
face = Math.floor( a + Math.random() * b );
Front
shifting value, scaling factor
Back
_________ are data structures consisting of related data items (sometimes called collections of data items).
Front
arrays
Back
Which of the following is used to access members (or properties) of form elements?
Front
.
Back
The first statement below ________ the array while the second statement ________ the array.
var c;
c = new Array( 12 );
Front
declares, allocates
Back
When working with data stored in arrays, it's often necessary to determine whether an array contains a value that matches a certain ________.
Front
key value
Back
What does the variable string contain after the following code is executed?
var string = "Good luck on the test";
string = string.link("www.deitel.com");
Front
a link to www.deitel.com with the text "Good luck on the test"
Back
When a function invokes a new copy of itself, it is called a ________.
Front
recursive call
Back
The best way to develop and maintain a large program is to construct it from small, simple pieces called ________.
Front
modules
Back
The "prepackaged" functions that belong to JavaScript objects such as Math.pow and Math.round are often called ________.
Front
methods
Back
All variables declared in function definitions are ________.
Front
local variables
Back
Pass-by- ________ is the method of passing the argument's address in memory to a function.
Front
reference
Back
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.
Front
position number
Back
The sort method can be given a function to use for the comparisons it makes, called a(n) ________ function.
Front
comparator
Back
What is the value of num assuming that all 12 elements of array test are initialized to 3?
++test[ 7 ];
var num = test[ 7 ];
Front
4
Back
What does the following code do?
for ( var col = 0; col < a[ 2 ].length; ++col )
a[ 2 ][ col ] = 0;
Front
Sets all the elements in row 2 to zero
Back
What is the value of s1 after the following code is executed?
var s1 = "deitel and associates";
s1 = s1.slice( 6 );
Front
and associates
Back
In JavaScript, numbers and boolean values are passed to functions by ________.
Front
value
Back
JavaScript references the ________ object for you when you call its functions, so you don't need to use it directly.
Front
global
Back
Section 2
(9 cards)
Which of the following methods would you use to convert a list of Unicode values into a string containing the corresponding characters?
Front
fromCharCode
Back
Which of the following statements is false?
Front
Web applications can use the window object's localStorage property to store up to several megabytes of key/value-pair string data on the user's computer and can access that data across browsing sessions and browser tabs.
Back
Which of the following is not a method or property of the JavaScript Number object?
Front
toFloat
Back
What will variable value contain after the following code is executed?
var value = new Date();
value = value.valueOf();
Front
a large integer representing the number of milliseconds between midnight January 1, 1970 and the current date
Back
Which of the following is not a method?
Front
strike( )
Back
To find out when a document was last modified, use the document object's _____ property.
Front
lastModified
Back
A JSON object is represented as a list contained in _____.
Front
curly braces
Back
Which of the following is not a method of the JavaScript Boolean object?
Front
toInt
Back
________ are stored by the browser on the user's computer to maintain client-specific information during and between browser sessions.