This quiz tests your knowledge of PHP decision-making structures and operators, helping you understand how PHP controls program flow.
Question 3
Which logical operator returns true only if both operands are true?
or
xor
and
or &&
!
Question 5
What happens if none of the cases in a switch
Statement match?
The first case runs
The program throws an error
The default
case runs if provided
Nothing happens
Question 6
What is the purpose of the break
statement inside a switch
?
To restart the switch cases
To stop the execution of all cases
To stop executing further cases after a match
To skip the current case
Question 7
What statement performs different actions based on multiple possible values of a variable?
if
switch
else
while
Question 8
How do you check multiple sequential conditions in PHP?
if...else
switch
if...elseif...else
for
loop
Question 9
What does the if
statement do in PHP?
Executes code only if a condition is false
Executes code only if a condition is true
Executes code regardless of any condition
Stops program execution
Question 10
What does this PHP code output?
$age = 20; echo ($age >= 18) ? "Adult" : "Minor";
Minor
Adult
Error
Nothing
There are 10 questions to complete.