
JS Functions & Parameters Review
Quiz
•
Computers
•
9th - 12th Grade
•
Medium
Tracy Hebert
Used 37+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Why do we write functions?
Make our code easier to understand by giving a readable name to a group of instructions
Avoid writing repeated code
Make our code reusable
All of the above
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the following function printThreeTimes:
function printThreeTimes(word){
println(word);
println(word);
println(word);
}
What is the parameter of the function?
printThreeTimes
function
println
word
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is the output of the following program?
function start(){
var x=5;
sumTo(x);
println(x);
}
function sumTo(num){
var sum=0;
for(var i=0; i<=num; i++){
sum +=i;
}
println(sum);
}
5
15
15
5
5
15
none - there is a syntax error
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What is printed by the following program?
function printNumbers(two, one, zero) {
println(two);
println(one);
println(zero);
}
function start(){
var zero=0;
var one =1;
var two=2;
printNumbers(zero, one, two);
}
2
1
0
0
1
2
zero
one
two
two
one
zero
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
How many parameters go into the function sum, and how many return values come out of the function sum?
function sum(first, second, third){
var result=first+second+third;
println(first);
println(second);
println(third);
return result;
}
3 parameters go in, 1 return value comes out
3 parameters go in, 3 return values come out
1 parameter goes in, 4 return values come out
1 parameter goes in, 1 return value comes out
6.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
We want to write a function isSuperman that takes in two parameters isBird and isPlane and returns true if it is in fact Superman and false otherwise. If it's not a bird and it's not a plane, it must be Superman. Which of the following functions is the correct implementation of isSuperman?
function isSuperman(isBird, isPlane){
return isBird || isPlane?}
function isSuperman(isBird, isPlane){
return !isBird || !isPlane;}
function isSuperman(isBird, isPlane){
return !isBird && !isPlane;}
function isSuperman(isBird, isPlane){
return isBird && isPlane;}
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the following code:
function start(){
var length=5;
var width=4;
rectangleArea(length, width);}
/*This function prints out the area of a triangle given its base and height */
function rectangleArea(base, height){
var area=base * height;
println(area);}
What are the names of the parameters?
length and width
length and height
base and height
base and width
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
19 questions
Python Year 9 Quiz
Quiz
•
8th - 10th Grade
10 questions
EMPTECH L4 Q2
Quiz
•
12th Grade
20 questions
Ինֆորմատիկա 10 II կիսամյակի ամփոփիչ աշխատանք
Quiz
•
10th - 12th Grade
12 questions
FUN QUIZ
Quiz
•
8th - 9th Grade
10 questions
Data Engineering y BigQuery V1
Quiz
•
12th Grade
20 questions
Grade-09 ICT
Quiz
•
9th Grade
10 questions
Vertex AI Pipelines V1
Quiz
•
12th Grade
15 questions
Начала программирования на языке Паскаль
Quiz
•
8th - 11th Grade
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
•
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
•
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
•
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
•
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
•
3rd Grade
14 questions
Christmas Trivia
Quiz
•
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
•
5th Grade
