#### PHP Conditional Statements Publishing Model Question Paper 1

12th Standard

Reg.No. :
•
•
•
•
•
•

Computer Applications

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

(a)

how are u

(b)

hi

(c)

error

(d)

no output

2. 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

3. 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

4. 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

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. Define if statement in PHP.

9. What is if else statement in PHP?

10. Write the Syntax of Switch statement.

11. Compare if and if else statement.

12. 5 x 3 = 15
13. Write the features Conditional Statements in PHP.

14. Differentiate Switch and if else statement

15. Differentiate if statement and if else if else stament.

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. 4 x 5 = 20
19. Explain the if elseif else statement. With suitable example.

20. Explain if else statement in PHP. With an example.

21. Write a PHP code to display the days of weak using switch statement

22. Write a PHP program to display week days using switch case statement.