Why do we write functions?
Functions and Parameters Quiz

Quiz
•
Computers
•
9th - 12th Grade
•
Hard
DeLaina Pruitt
Used 9+ times
FREE Resource
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
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
30 sec • 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
45 sec • 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
45 sec • 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
45 sec • 1 pt
How many parameters to 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
45 sec • 1 pt
"It's a bird! It's a plane! No, it's Superman!"
We want to write a function isSuperman that takes in two parameters isBird and isPlane and returns true if it in 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
30 sec • 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
Create a free account and access millions of resources
Similar Resources on Quizizz
16 questions
JavaScript Programming Quiz

Quiz
•
9th - 12th Grade
11 questions
CMU CS Academy Unit 2 Part 3 Mouse Release Events

Quiz
•
9th Grade
10 questions
Functions and Parameters Summative preview

Quiz
•
9th - 12th Grade
15 questions
JavaScript Knowledge & Skills

Quiz
•
9th - 12th Grade
20 questions
Basic JavaScript Review

Quiz
•
9th - 12th Grade
15 questions
CodeHS Functions and Control Variables

Quiz
•
9th - 12th Grade
16 questions
Arithmetic Types Declare Initialize Relation Logical Ops

Quiz
•
9th Grade - University
16 questions
Loops

Quiz
•
5th - 12th Grade
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade
Discover more resources for Computers
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
20 questions
Taxes

Quiz
•
9th - 12th Grade
17 questions
Parts of Speech

Quiz
•
7th - 12th Grade
20 questions
Chapter 3 - Making a Good Impression

Quiz
•
9th - 12th Grade
20 questions
Inequalities Graphing

Quiz
•
9th - 12th Grade
10 questions
Identifying equations

Quiz
•
KG - University