#### PHP Conditional Statements Model Question Paper

12th Standard EM

Reg.No. :
•
•
•
•
•
•

Computer Applications

Time : 00:45:00 Hrs
Total Marks : 40
5 x 1 = 5
1. What will be the output of the following PHP code ?
< ?php
x;
if (x == 0)
print “hi” ;
else
print “how are u”;
print “hello”
? >

(a)

how are uhello

(b)

hihello

(c)

hi

(d)

no output

2. Statement which is used to make choice between two options and only option is to be performed is written as

(a)

if statement

(b)

if else statement

(c)

then else statement

(d)

else one statement

3. What will be the output of the following PHP code ?
< ?php
 a = “”;
if (a)
print “all”;
if
else
print “some”;
? >

(a)

all

(b)

some

(c)

error

(d)

no output

4. What 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”;
? >

(a)

how are u

(b)

hi

(c)

error

(d)

no output

5. What will be the output of the following PHP code ?
< ?php
if (-100)
print “hi” ;
else
print “how are u”;
? >

(a)

how are u

(b)

hi

(c)

error

(d)

no output

6. 5 x 2 = 10
7. Define Conditional Statements in PHP

8. Write Syntax of Switch statement.

9. Compare if and if else statement.

10. What IS"if statement" in PHP?

11. Write the syntax of If statement.

12. 5 x 3 = 15
13. Differentiate Switch and if else statement

14. Differentiate if statement and if else if else stament.

15. Write a PHP code to display "Have a nice weekend!" if the current day is Friday, otherwise it will output "Have a nice day!" using if-else statement.

16. Write a php program to check whether the given number is positive or negative.

17. Write, a PHP program to display independenc day and republic day the greetings using If elseif else statement.

18. 2 x 5 = 10
19. Explain the process Conditional Statements in PHP?

20. Explain concepts of if elseif else statement.