New ! Computer Applications MCQ Practise Tests



PHP Conditional Statements Model Questions

12th Standard

    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”;
    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)

    Multiple branching

  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)

    Alternative statement

    6 x 2 = 12
  16. What are the different types of conditional statements in PHP?

  17. Write the syntax for an if statement in PHP.

  18. What is the purpose of the if ... else statement?

  19. How conditional statements 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 elseif else statement.

  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

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

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

Write your Comment