PHP Conditional Statements Model Questions

12th Standard EM

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Applications

Time : 01:00:00 Hrs
Total Marks : 50
    6 x 1 = 6
  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
    \($\)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

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

  7. 4 x 1 = 4
  8. Simple if statements

  9. (1)

    Alternative statement

  10. If-else statement

  11. (2)

    Only one option

  12. If elseif else statement

  13. (3)

    Combination of if-else statement

  14. Switch case statement

  15. (4)

    Multiple branching

    6 x 2 = 12
  16. Define Conditional Statements in PHP

  17. Define if statement in PHP.

  18. What is if else statement in PHP?

  19. How conditionalstatements perform?

  20. What IS"if statement" in PHP?

  21. How SWitch statement and if statement differs?

  22. 6 x 3 = 18
  23. Differentiate Switch and if else statement

  24. Write Short notes on Switch statement

  25. Differentiate if statement and if else if else stament.

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

  27. Write a php program to birthday greetings using if statement.

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

  29. 2 x 5 = 10
  30. Write a PHP code to display the days of weak using switch statement

  31. Explain real world usages in using Conditional Statements.

*****************************************

TN 12th Standard EM Computer Applications free Online practice tests

Reviews & Comments about 12th Standard Computer Application PHP Conditional Statements Model Question Paper

Write your Comment