What is the purpose of a parameter in a function?
A parameter allows a function to accept input values so it can operate on different data each time it is called(multiple ways to answer this)
What is the purpose of a return statement in a function?
It sends a value back to the caller of the function.
What is the output:
25
What are three consecutive strikes in bowling called?
Turkey
What is the difference between a parameter and an argument?
A parameter is a variable defined in the function to accept input; an argument is the actual value passed when calling the function.
What will this code output?
5
What is printed?
console.log(72%4);
0, 4 goes into 72 evenly.
What does HTTP stand for?
Hypertext Transfer Protocol
List at least 5 possible parameters for a function called makePizza()
answers may vary
What is the output?
false
Predict the output:
10 (0 + 1 + 2 + 3 + 4 = 10)
Name the three main types of rock in geology.
Igneous, Sedimentary, Metamorphic
function combine(a, b ) {
return a + b;
}
console.log(combine(5,0));
console.log(combine(3, 10));
5 // 5 + 0 = 5
13 // 3 + 10 = 13
This function finds the largest number in a list. What should replace <MISSING CODE>?
function findMax(list){
var max = list[0];
for(var i = 0; i < list.length; i++){
if(list[i] > max){
<MISSING CODE>
}
}
return max;
}
max = list[i];
What does this code print?
8
Name the professional MLB and NBA teams that represent the city of Toronto
Blue Jays, Raptors
What will this code print?
12
What does this code print? Explain why.
120 (This calculates 5! = 12345)
function sum(n) {
var total = 0;
for (var i = 1; i <= n; i += 2) {
total += i;
}
return total;
}
console.log(sum(10));
25 (1 + 3 + 5 + 7 + 9 = 25)
What is the signature food dish served at Wimbledon?
Strawberries and cream