New ! Computer Applications MCQ Practise Tests



PHP Conditional Statements Model Question Paper

12th Standard

    Reg.No. :
  •  
  •  
  •  
  •  
  •  
  •  

Computer Applications

Time : 02: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. 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”;
    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. 3 x 1 = 3
  7. What will be the output of the following PHP code?
    < ?php
    if(0.1)
    print''hi'';
    else
    print''how are u";
    ? >

    (a)

    hi

    (b)

    error

    (c)

    no output

    (d)

    how are u

  8. What will be the output of the following PHP code?
    < ?php
    $x= 1;
    if($x==2)
    print''hi'';
    elseif($x=2)
    print $x;
    else
    print''how are u";
    ? >

    (a)

    error

    (b)

    2

    (c)

    hi

    (d)

    how are u

  9. What will be the output of the following PHP code?
    < ?php
    $a="1";
    switch($a)
    {
    case 1 :
    break;
    print''hi'';
    case 2:
    print''hello'';
    break;
    default:
    print''hi1'';
    }
    ? >

    (a)

    hihellohi1

    (b)

    hi

    (c)

    hihi1

    (d)

    hi1

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

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

  13. Write the Syntax of an If ... else statement in PHP.

  14. Write the usage of Switch Statement in PHP.

  15. Write the Syntax of Switch statement.

  16. Compare if and if else statement.

  17. 5 x 3 = 15
  18. Write the features Conditional Statements in PHP.

  19. Differentiate Switch and if else statement.

  20. Differentiate if statement and if elseif else statement.

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

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

  23. 3 x 5 = 15
  24. Explain the Function of Conditional Statements in PHP.

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

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

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

Write your Comment