Font size
WorksheetsUnit 4 Wrap-up
Total questions: 20
Worksheet time: 3600secs
Which of these are correct methods to create a function?
function myFunction {
// Some code }
function myFunction[] {
// Some code }
function myFunction() {
// Some code }
function myFunction(x, y, z) {
// Some code }
Given the following code, which is considered the parameters of the function
function myFunction(a, b, c) {
var x = a + b + c;
}
x
a
b
c
Given the following code, what is the final value of x?
var x = 0;
function myXFunction() {
x = x + 10;
}
x = x + 1;
11
0
10
1
What should go into the indicated location make the final value of x = 11?
var x = 0;
function myXFunction() {
x = x + 10;
}
WRITE CODE HERE
x = x + 1;
function myXFunction()
MYXFUNCTION()
myXFunction()
myxfunction()
Fill in the blanks to allow the following button invoke the myFunction function when clicked
<button id="myButton" (a) />
function myFunction() {
//Some Code }
Which of the following code will allow the button to invoke hisFunction?
<button id="myButton" value="Click Me" ________ />
function hisFunction(X, Y) {
//Some Code }
onclick = "hisFunction()"
onclick = "hisFunction"
onclick = "hisFunction(1)"
onclick = "hisFunction(1, 2)"
What code will result in the above?
alert("Please enter your phone number:")
confirm("Please enter your phone number:")
prompt("Please enter your phone number:")
In which one of these lines of code is A, B and C considered arguments?
function myFunction(A, B, C) { ... }
function myFunction() {
var A; var B; var C; }
myFunction(A, B, C);
var x = function(A, B, C) { ... };
Identify the parameter in the following code:
function First(Second) {
var Third = 0;
}
First(Fourth);
First
Second
Third
Fourth
A JavaScript function is defined with the ______ keyword, followed by a name, followed by parentheses ().
let
function
argument
parameter
Function ______ are listed inside the parentheses () in the function definition.
Parameters
Arguments
Invokes
functions
Function ______ are the values received by the function when it is invoked.
Parameters
Arguments
Invokes
Functions
The code inside the function will execute when "something" ______ (calls) the function:
Parameters
Arguments
Invokes
Functions
If a function in JavaScript is called with missing arguments (less than declared), the missing values are set to ________.
Undefined
Error
NaN
BaNANa
We can assign a _________ to a parameter, in case an argument is not passed to the function.
default value
implicit value
intrinsic value
parametric value
Which line of code has the function being invoked?
1
2
3
4
5
Which line of code includes declaring the parameters of the function?
1
2
3
4
5
What are the arguments of the given function?
x and y
function
multiply
5 and 6
What is the name of the function?
x and y
function
multiply
5 and 6
What are the parameters of the given function?
x and y
function
multiply
5 and 6
