JavaScript Functions and Parameters
Quiz
•
Computers
•
9th - 12th Grade
•
Hard
Thomas Martinez
FREE Resource
Enhance your content in a minute
33 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
45 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
word
println
2.
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
3.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What is printed by the following program?
function product(x, y){
return x * y;
}
function difference(x, y){
return x - y;
}
function start(){
var x = 2;
var y = 5;
var value1 = product(x, y);
var value2 = difference(y, x);
var result = difference(value1, value2);
println(result);
}
-7
7
13
-13
4.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following type of variable is visible everywhere in your code?
global
local
integer
string
5.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
Consider the following code snippet. What is returned and printed for the value of a?
function start(){
var a = mystery(10, 14);
var b = mystery(82, 28);
println(a);
println(b);
}
function mystery(x, y) {
if (x < y){
return x;
}else{
return y;
}
}
10
14
28
82
6.
MULTIPLE CHOICE QUESTION
2 mins • 1 pt
What does the mystery function do in the code snippet below?
function start(){
var a = mystery(10, 14);
var b = mystery(82, 28);
println(a);
println(b);
}
function mystery(x, y) {
if (x < y){
return x;
}else{
return y;
}
}
mystery does nothing because there is a syntax error
returns the larger of the two values passed to it
returns the smaller of two values passed to it
mystery does nothing because there is a logical error
7.
MULTIPLE CHOICE QUESTION
5 mins • 1 pt
Consider the following code snippet:
function mystery1(x){
var result = x + 1;
return result;
}
function mystery2(x, y){
var result = x + y;
return result;
}
function mystery3(x){
x = mystery1(x);
var result = x * x;
return result;
}
What would the following print?
var y = mystery3(11);
println(y);
13
121
144
This would not print anything
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
30 questions
Assessment Term 2.2 - Y9 U4 Python Search algorithms
Quiz
•
7th - 12th Grade
32 questions
Year 9 Digital Media and Sound Assessment
Quiz
•
10th Grade
35 questions
Puertos PC
Quiz
•
9th Grade
29 questions
Exam Revision 3
Quiz
•
12th Grade
30 questions
Banana Tales - Mid Test 01/2021
Quiz
•
9th - 11th Grade
28 questions
Understanding Esports
Quiz
•
11th Grade
30 questions
Tin 10_ ôn táºp giữa kì 2
Quiz
•
10th Grade
29 questions
BLENDER INTRO_2
Quiz
•
9th - 12th 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
