FST Class 2023- Quiz 3

Quiz
•
Computers
•
University
•
Medium
FunctionUp School of Technology
Used 1+ times
FREE Resource
8 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
What is the purpose of the `else` clause in an `if-else` statement?
To define multiple conditions
To create a new block of code
To handle the case when the `if` condition is true
To handle the case when the `if` condition is false
2.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
How do you write an `if-else` statement with multiple conditions?
if (condition1 && condition2)
if (condition1 || condition2)
if (condition1) else if (condition2)
if (condition1) else else (condition2)
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
3. What is the output of the following code?
ar num = 10;
if (num > 8) {
console.log("Greater than 8");
} else if (num > 10) {
console.log("Greater than 10");
} else {
console.log("Other");
}
Greater than 5
Greater than 8
Other
d) No output
4.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
What does a nested `if-else` statement consist of?
Two separate `if` statements
An `if` statement inside an `else` statement
Multiple `if` statements combined using logical operators
An `if` statement inside another `if` statement
5.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Which of the following correctly shows the syntax for a nested `if-else` statement?
if (condition1) if (condition2)
if (condition1) { if (condition2) }
if (condition1) else (condition2)
if { condition1 } else { condition2 }
6.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What will be the output if the condition in an `if` statement is false and there is no `else` block?
It will throw an error
It will output "false"
It will output "true"
There will be no output
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the purpose of the `else if` clause in an `if-else` statement?
It is used to create a nested condition
It is used to handle multiple conditions sequentially
It is used to define the final else condition
d) It is used to create a new code block
8.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
What is the purpose of the `else if` clause in an `if-else` statement?
It is used to create a nested condition
It is used to handle multiple conditions sequentially
It is used to define the final else condition
d) It is used to create a new code block
Similar Resources on Wayground
10 questions
Selection Control Structure in Programming Fundamentals

Quiz
•
University
10 questions
CW-GR12-if conditions

Quiz
•
8th Grade - University
13 questions
Keep It Really Safe Lego SPIKE Prime Lesson Review

Quiz
•
7th Grade - University
6 questions
Unit 5 : Decision Control in C

Quiz
•
University
10 questions
LOOPS IN C++

Quiz
•
10th Grade - University
13 questions
Intro to IF statements

Quiz
•
KG - University
10 questions
Workshop 2 Review

Quiz
•
University
10 questions
if/else statements quiz

Quiz
•
9th Grade - University
Popular Resources on Wayground
18 questions
Writing Launch Day 1

Lesson
•
3rd Grade
11 questions
Hallway & Bathroom Expectations

Quiz
•
6th - 8th Grade
11 questions
Standard Response Protocol

Quiz
•
6th - 8th Grade
40 questions
Algebra Review Topics

Quiz
•
9th - 12th Grade
4 questions
Exit Ticket 7/29

Quiz
•
8th Grade
10 questions
Lab Safety Procedures and Guidelines

Interactive video
•
6th - 10th Grade
19 questions
Handbook Overview

Lesson
•
9th - 12th Grade
20 questions
Subject-Verb Agreement

Quiz
•
9th Grade