
PHP Conditional Statements
Quiz by Sudha Krishnan
Feel free to use or edit a copy
includes Teacher and Student dashboards
Measure skillsfrom any curriculum
Measure skills
from any curriculum
Tag the questions with any skills you have. Your dashboard will track each student's mastery of each skill.
With a free account, teachers can
- edit the questions
- save a copy for later
- start a class game
- automatically assign follow-up activities based on students’ scores
- assign as homework
- share a link with colleagues
- print as a bubble sheet
10 questions
Show answers
- Q1What will be the output of the following PHP code? <?php $x if($x) print “hi”; else print “how are you”; ?>errorhow are youhihello30s
- Q2What will be the output of the following PHP code ? <?php $x=0; if( $x++) print “hi”; else print “how are you”; ?>hierrorhow are you$x30s
- Q3What will be the output of the following PHP code ? <?php $x if($x==0) print “hi”; else print “how are you”; print “hello” ?>how are you hellohow are youno outputhihello30s
- Q4Statement which is used to make choice between two options and only option is to be performed is written aselse statementelse one statementif else statementif statement30s
- Q5What will be the output of the following PHP code ? <?php $a=””; if($a) print “all”; if else print “some”; ?>errorallsomeallsome30s
- Q6What will be the output of the following PHP code ? <?php $a=””; if($a) print “all”; else print “some”; ?>errorsomeno outputall30s
- Q7What will be the output of the following PHP code ? <?php $x=10; $y=20; If($x>$y + $y != 3) print “hi” ; else print “how are u”; ?>no outputhow are youhierror30s
- Q8What will be the output of the following PHP code ? <?php $x=10; $y=20; If($x>$y && 1||1) print “hi” ; else print “how are u”; ?>errorhihow are youno output30s
- Q9What will be the output of the following PHP code ? <?php if(-100) print “hi”; else print “how are you”; ?>errorhow are youno outputhi30s
- Q10______ statements are useful for writing decision making logic.SequentialComparativeIterativeConditional30s