
PHP Conditional Statements Quiz
Quiz
•
Information Technology (IT)
•
Professional Development
•
Hard
Cecilio Salonoy
Used 4+ times
FREE Resource
40 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the simplest form of a conditional statement in PHP?
if() else
if()
switch
elseif()
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which operator is used to compare values in a PHP conditional statement?
Arithmetic operator
Comparison operator
Logical operator
Assignment operator
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code if $grade = 80? if($grade < 75) { $remark = "Failed"; } else { $remark = "Passed"; }
"Failed"
"Passed"
No output
Error
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which conditional statement allows multiple branches but executes only one true condition?
if()
if() else
if() elseif()
while()
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the purpose of the else statement in PHP?
To execute code when the if condition is true
To execute code when the if condition is false
To repeat a block of code
To define a function
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the value of $remark if $grade = 60? if($grade >= 90) { $remark = "Excellent"; } elseif($grade >= 75) { $remark = "Good"; } else { $remark = "Needs Improvement"; }
"Excellent"
"Good"
"Needs Improvement"
No output
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is the correct syntax for an if() else statement?
if(condition) { code; } else(condition) { code; }
if(condition) { code; } else { code; }
if(condition) code; else code
if(condition) code; else(condition) code;
Create a free account and access millions of resources
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
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?
Similar Resources on Wayground
40 questions
Object-Oriented Programming Quiz
Quiz
•
Professional Development
40 questions
PHP Functions Quiz
Quiz
•
Professional Development
45 questions
CCST - Networking
Quiz
•
Professional Development
40 questions
Cryptography Quiz
Quiz
•
Professional Development
40 questions
Revision Part 2 - Azure Architecture and Services
Quiz
•
Professional Development
38 questions
Informática Básica
Quiz
•
Professional Development
Popular Resources on Wayground
10 questions
Ice Breaker Trivia: Food from Around the World
Quiz
•
3rd - 12th Grade
20 questions
Halloween Trivia
Quiz
•
6th - 8th Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
4 questions
Activity set 10/24
Lesson
•
6th - 8th Grade
22 questions
Adding Integers
Quiz
•
6th Grade
10 questions
How to Email your Teacher
Quiz
•
Professional Development
15 questions
Order of Operations
Quiz
•
5th Grade
30 questions
October: Math Fluency: Multiply and Divide
Quiz
•
7th Grade
Discover more resources for Information Technology (IT)
10 questions
How to Email your Teacher
Quiz
•
Professional Development
11 questions
NFL Football logos
Quiz
•
KG - Professional Dev...
16 questions
Spooky Season Quiz
Quiz
•
Professional Development
10 questions
Halloween Trivia
Quiz
•
Professional Development
20 questions
Context Clues: Multiple Meaning Words
Quiz
•
Professional Development
18 questions
Do or Does
Quiz
•
Professional Development
31 questions
Servsafe Food Manager Practice Test 2021- Part 1
Quiz
•
9th Grade - Professio...
