True or false: else statements and else if statements MUST follow an if statement
if/else statements quiz

Quiz
•
Computers
•
9th Grade - University
•
Hard
Maria Sandu
Used 80+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
True
False
Answer explanation
"else" implies that the condition of the preceding if statement is false, therefore else and else if statements must follow an if statements
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
True or false: an if statement MUST be followed by an else statement
True
False
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
An if statement (i.e. if (condition) { ... }) will only execute if...
The condition is true
The condition is false
It always executes
It never executes
4.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
A statement of the form else if (condition) { ... } will only execute if...
The condition in parentheses is true and the preceding if statement executes
The condition in parentheses is true and the preceding if statement does NOT execute
The condition in parentheses
Answer explanation
"else" implies that the condition of the preceding if statement must be false; the condition in parentheses following "if" must be true in order for the statement to execute
5.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
An else statement (of the form else { ... } will only execute if...
All preceding if and else if statements do NOT execute
All preceding if and if else statements execute
It always executes
It never executes
Answer explanation
"else" implies that all the conditions of the preceding if and else if statements are false, meaning that they do not execute
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Can a nested if statement execute if the outer conditional statement is false?
Yes
No
Answer explanation
A nested if statement is inside another conditional statement. If the outer conditional does not have its condition fulfilled, then the code inside of it can never execute.
7.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
Which of the following conditional statements is executed?
The if statement
if (z == 3) { ... }
The else if statement
else if (z < 5) { ... }
The else statement
else { ... }
None of them
Answer explanation
Let's look at each of the conditionals:
if (z == 3) { ... } cannot be executed because z is not equal to 3
else if (z < 5) { ... } cannot be executed because z is not less than 5
Therefore, the else statement at the bottom must be executed since all the previous conditionals do not execute
Create a free account and access millions of resources
Similar Resources on Quizizz
15 questions
PROGRAMMING IN PYTHON - UNIT II - TEST 1 MCQS

Quiz
•
University
6 questions
Unit 5 : Decision Control in C

Quiz
•
University
15 questions
Quiz - 9 on if-else

Quiz
•
12th Grade
13 questions
Control Structures in Python

Quiz
•
11th - 12th Grade
11 questions
49. Programming 1 : Basic Programming Constructs

Quiz
•
9th - 12th Grade
8 questions
Making Selections

Quiz
•
10th Grade
10 questions
Class 9 Conditional Statement

Quiz
•
9th Grade
10 questions
Programming - Iteration, Basic Programming Constructs & Loop

Quiz
•
2nd - 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