
JavaScript Conditional Statements Quiz
Quiz
•
Computers
•
12th Grade
•
Practice Problem
•
Medium
Lara Luca
Used 5+ times
FREE Resource
Enhance your content in a minute
15 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code output? ```javascript if (5 > 3) { console.log("Yes"); } else { console.log("No"); } ```
Yes
No
Undefined
Error
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Consider the code snippet below. What will be the output? ```javascript let age = 18; if (age > 18) { console.log("Adult"); } else if (age == 18) { console.log("Just turned adult"); } else { console.log("Not an adult"); } ```
Adult
Just turned adult
Not an adult
Error
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What does the following code print? ```javascript let x = 10; if (x > 5) { if (x < 15) { console.log("Yes"); } } else { console.log("No"); } ```
Yes
No
Undefined
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is true about the `else` statement in JavaScript?
It executes a block of code if the condition in the `if` statement is true.
It can appear without an `if` statement.
It executes a block of code if the condition in the `if` statement is false.
It can only be used once in an `if-else` chain.
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
How many times can `else if` statements be used in an `if-else` chain?
Only once
Up to 3 times
As many times as needed
Not at all
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will the following code snippet output? ```javascript let score = 75; if (score >= 90) { console.log("A"); } else if (score >= 80) { console.log("B"); } else if (score >= 70) { console.log("C"); } else { console.log("F"); } ```
A
B
C
F
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the output of the following code? ```javascript let num = 20; if (num > 15) { console.log("Greater"); } else if (num == 20) { console.log("Equal"); } else { console.log("Lesser"); } ```
Greater
Equal
Lesser
Error
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
10 questions
What would you do if...
Quiz
•
1st - 12th Grade
17 questions
Storage
Quiz
•
9th - 12th Grade
10 questions
🔦 Formative Assessment 2: Flow Controls
Quiz
•
12th Grade
10 questions
VLAN 1
Quiz
•
12th Grade
14 questions
Ted Drones
Quiz
•
10th - 12th Grade
15 questions
หน่วยที่ 1 ความรู้พื้นฐานการจัดการ ข้อมูลขนาดใหญ่ (Big Data)
Quiz
•
9th - 12th Grade
17 questions
Quiz 01 Keamanan Jaringan
Quiz
•
12th Grade
10 questions
Selection Control Structure Quiz
Quiz
•
6th Grade - University
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
