Deck 9: Javascript: Functions
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/24
Play
Full screen (f)
Deck 9: Javascript: Functions
1
Functions that are not provided as part of the JavaScript language are called ________ functions.
A) add-on
B) programmer-defined
C) man-made
D) extra
A) add-on
B) programmer-defined
C) man-made
D) extra
B
2
The value a in the following statement is called the ________ and the value b is called the ________.
Face = Math.floor( a + Math.random() * b );
A) scaling factor, shifting value
B) shifting value, scaling factor
C) scaling value, shifting factor
D) shifting factor, scaling value
Face = Math.floor( a + Math.random() * b );
A) scaling factor, shifting value
B) shifting value, scaling factor
C) scaling value, shifting factor
D) shifting factor, scaling value
B
3
The "prepackaged" functions that belong to JavaScript objects such as Math.pow and Math.round are often called ________.
A) subroutines
B) routines
C) methods
D) functions
A) subroutines
B) routines
C) methods
D) functions
C
4
The best way to develop and maintain a large program is to construct it from small, simple pieces called ________.
A) scripts
B) modules
C) scriptlets
D) objects
A) scripts
B) modules
C) scriptlets
D) objects
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
5
Which of the following is used to access members (or properties) of form elements
A) *
B) ,
C) )
D) ;
A) *
B) ,
C) )
D) ;
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
6
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
A) game.point = "10"
B) game.point.text = "10"
C) game.point.caption = "10"
D) game.point.value = "10"
A) game.point = "10"
B) game.point.text = "10"
C) game.point.caption = "10"
D) game.point.value = "10"
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
7
The technique of developing and maintaining a large program by constructing it from small, simple pieces is called ________.
A) divide and conquer
B) modular programming
C) multitasking
D) multiprogramming
A) divide and conquer
B) modular programming
C) multitasking
D) multiprogramming
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
8
The style of programming in which the user interacts with a GUI component is called ________ programming.
A) object-oriented
B) automatic
C) event-driven
D) modular
A) object-oriented
B) automatic
C) event-driven
D) modular
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
9
Which of the following is not a global function
A) parseInt
B) escape
C) square
D) eval
A) parseInt
B) escape
C) square
D) eval
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
10
Nested in the audio element are two ________ specifying the locations of the audio clip in MP3 and OGG formats, respectively.
A) source elements
B) media elements
C) preload attributes
D) location elements
A) source elements
B) media elements
C) preload attributes
D) location elements
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
11
JavaScript references the ________ object for you when you call its functions, so you don't need to use it directly.
A) document
B) local
C) scriptlevel
D) Global
A) document
B) local
C) scriptlevel
D) Global
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
12
All variables declared in function definitions are ________.
A) global variables
B) local variables
C) static variables
D) constant variables
A) global variables
B) local variables
C) static variables
D) constant variables
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
13
Which of the following is a legal function call for the function definition provided below
Function square( y )
{
Return y * y;
}
A) square(7+2);
B) (7).square;
C) square(7,2);
D) square 7;
Function square( y )
{
Return y * y;
}
A) square(7+2);
B) (7).square;
C) square(7,2);
D) square 7;
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
14
Change an image's ________ attribute to change which picture it displays.
A) location
B) URL
C) src
D) source
A) location
B) URL
C) src
D) source
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
15
Which of the following are valid names of scopes in JavaScript
A) local
B) global
C) variable
D) Both (a) and (b)
A) local
B) global
C) variable
D) Both (a) and (b)
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
16
What is the result of writing the keyword var in a function parameter list
A) The result would be a JavaScript runtime error.
B) The parameter following the keyword would have global scope.
C) The parameter following the keyword would have local scope.
D) The parameter following the keyword would become a static variable.
A) The result would be a JavaScript runtime error.
B) The parameter following the keyword would have global scope.
C) The parameter following the keyword would have local scope.
D) The parameter following the keyword would become a static variable.
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
17
A function's ________ are also considered to be local variables.
A) parameters
B) static variables
C) register variabless
D) constant variables
A) parameters
B) static variables
C) register variabless
D) constant variables
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
18
Giving a local function variable the same name as a global variable will result in which of the following
A) JavaScript runtime error.
B) Data corruption.
C) The local function variable will rename itself.
D) The local variable will "hide" the global variable.
A) JavaScript runtime error.
B) Data corruption.
C) The local function variable will rename itself.
D) The local variable will "hide" the global variable.
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
19
What does the following statement do
Math.floor( Math.random() * 12 );
A) This creates a random number from 0 up to and including 12.
B) This creates a random number from 0 up to but not including 12.
C) This creates a random number from 1 up to and including 12.
D) This creates a random number from 1 up to but not including 12.
Math.floor( Math.random() * 12 );
A) This creates a random number from 0 up to and including 12.
B) This creates a random number from 0 up to but not including 12.
C) This creates a random number from 1 up to and including 12.
D) This creates a random number from 1 up to but not including 12.
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
20
What would the function cube return, assuming it is called with the statement cube( 3 )
Function cube( y );
{
Return y * y * y;
}
A) JavaScript runtime error
B) 3
C) 9
D) 27
Function cube( y );
{
Return y * y * y;
}
A) JavaScript runtime error
B) 3
C) 9
D) 27
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
21
Iteration uses ________ statements and recursion uses ________ statements.
A) counter-recursive, counter-iterative
B) repetition, function calling
C) repetition, selection
D) function-calling, repetition
A) counter-recursive, counter-iterative
B) repetition, function calling
C) repetition, selection
D) function-calling, repetition
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
22
A function that calls itself either directly or indirectly through another function is called a ________ function.
A) base case
B) iterative
C) recursive
D) fibonacci
A) base case
B) iterative
C) recursive
D) fibonacci
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
23
When does a recursive program go into infinite recursion
A) if the loop-continuation test never becomes false
B) if the recursion test never becomes false
C) if the loop-continuation test never becomes true
D) if the recursion step does not converge on the base case
A) if the loop-continuation test never becomes false
B) if the recursion test never becomes false
C) if the loop-continuation test never becomes true
D) if the recursion step does not converge on the base case
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck
24
When a function invokes a new copy of itself, it is called a ________.
A) base case
B) final step
C) base case
D) recursive call
A) base case
B) final step
C) base case
D) recursive call
Unlock Deck
Unlock for access to all 24 flashcards in this deck.
Unlock Deck
k this deck