
Conditional Quiz
Quiz
•
Computers
•
3rd - 12th Grade
•
Practice Problem
•
Easy
Donna Panter
Used 6+ times
FREE Resource
Enhance your content in a minute
21 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output by the code below?
var dogs = 4;
if (dogs > 3) {
write("Boxer");
} else if (dogs <= 2) {
write("Golden Retriever");
}
Boxer
Golden Retriever
True
No output
Answer explanation
4 is greater than 3 so the first if statement evaluates true. Therefore the first write is what is outputted.
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output?
var cat = 3;
if (cat == 2) {
write("Good kitty");
} else if (cat == 3) {
write("Mean kitty");
} else if (cat == 1) {
write("Ugly kitty");
}
Good kitty
Mean kitty
Ugly kitty
true
Answer explanation
if (cat == 2) {
write("Good kitty");
} else if (cat == 3) {
write("Mean kitty");
} else if (cat == 1) {
write("Ugly kitty");
}
Since cat is assigned the value of 3, the else if statement of cat == 3 is true. So the write of Mean kitty is written.
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output?
var dog = 9;
if ( (dog > 2) && (dog < 13) ) {
write("I love dogs");
} else if ( dog < 5 ) {
write("I love cats");
}
I love dogs
I love cats
true
no output
Answer explanation
if ( (dog > 2) && (dog < 13) ) {
write("I love dogs");
} else if ( dog < 5 ) {
write("I love cats");
}
Since dog holds the value of 9, the first if statement evaluates to true. So the output is I love dogs. The else if statement will not be evaluated since the if statement is true.
4.
FILL IN THE BLANK QUESTION
1 min • 1 pt
What is output?
var song = 3;
if (song > 9) {
write ("My favorite song is ");
} else if (song > 3) {
write("I don't like the song ");
} else if (song < 4) {
write("Sing the song ");
}
write("Chicken Nugget Song");
_____________________
5.
FILL IN THE BLANK QUESTION
1 min • 1 pt
What is output ?
var school = 3;
if (school <= 2) {
write("Texans");
} else {
write("Astros");
}
_____________________
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output?
var school = 3;
if ( school == 5 || 3) {
write("Phillies");
} else if (school > 4){
write("Cardinals");
}
Phillies
Cardinals
true
Phillies, but there is a syntax error
Answer explanation
syntax error because the or in the first if statement should have:
(school == 5) || (school == 3)
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is output?
var x = 32;
write( x >= 45 || x < 32 ) ;
true
false
32
45
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
20 questions
Administrasi Sistem jaringan KD1
Quiz
•
1st - 10th Grade
20 questions
Operating System Concept Management
Quiz
•
1st - 3rd Grade
16 questions
Grade 3 Class Activity- Nov 24, 2021
Quiz
•
3rd Grade
16 questions
FONKSİYON(function)
Quiz
•
1st - 8th Grade
20 questions
Skill Competition Quiz 2024
Quiz
•
10th Grade - University
20 questions
CSS - Operating System
Quiz
•
11th Grade
20 questions
Operator Aritmetika dan Perbandingan
Quiz
•
10th Grade
16 questions
Python #1 Grade #7
Quiz
•
7th Grade
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade
