PHP 5 Quiz # 7

Instructions
Quiz: PHP 5 Quiz # 7
Total Questions: 30 MCQs
Time: 30 Minutes

Note

  • Do not refresh the page while taking the test.
  • Results along with correct answers will be shown at the end of the test.
PHP 5 Quiz # 7
Question 1 of 30
00:00
  • After the code is executed, what will be the value of $text and what will strlen($text) return? $text ='John'; $text[10]='Doe';

  • What would you use a trait for?

  • What is the function file_get_contents() useful for?

  • Which of the following is a Ternary Operator?


  • The inbuilt function to get the number of parameters passed is:



  • How would you start a session?


  • What is the output of the following PHP code snippet?

    <?php
       $val = 10;
       $val2 = 20;
       function helloworld($a)
       {
          $val2 = $a * 30;
       }
       helloworld($val);

       echo $val2;
    ?>


  • Which of the following is true regarding $a + $b, where both of them are arrays?


  • What will be the result of following operation?
    print 4<< 5;


  • Which of the following features are supported in PHP 5?


  • If expire parameter of setCookie function is not specified then:


  • You have a 2D array in PHP:

    $array = array(array(141,151,161), 2, 3, array(101, 202, 303));

    You want to display all the values in the array. The correct way is:



  • Consider the following two statements:

    I while (expr) statement
    II while (expr): statement ... endwhile;

    Which of the following are true in context of the given statements?



  • Which of the following statements regarding PHP forms, are correct?


  • Which of the following type cast is not correct?

    1 <?php
    2 $fig = 23;
    3 $varbl = (real) $fig;
    4 $varb2 = (double) $fig;
    5 $varb3 = (decimal) $fig;
    6 $varb4 = (bool) $fig;
    7 ?>


  • What is the output of the following PHP code snippet?

    <?php
    $var = "testing module";
    $statement = 'This is a $var';
    echo ($statement);
    ?>


  • Which of the following variables is not related to file uploads?


  • Which of the following attribute is needed for file upload via form?


  • What will be the output of following code?

    $a = 10;
    echo "Value of a = $a";



  • You wrote following script to check for the right category:

    1        <?php
    2        $cate=5;
    3        ...
    4        ...
    5        
    6        if ($cate==5)
    7        {
    8        ?>
    9          Correct category!
    10        <?php
    11        } else {
    12        ?>
    13          Incorrect category!
    14        <?php
    15        }
    16        ?>

    What will be the output of the program if value of 'cate' remains 5?



  • Which of the following is a correct declaration?



  • If visibility is not defined for a method/member then it is treated as public static.


  • Which of the following crypto in PHP returns longest hash value?


  • How would you store order number (34) in an 'OrderCookie'?


  • Which of the following pair of operators have equal precedence and are non-associative?


  • Consider the following class:

    1 class Insurance
    2 {
    3 function clsName()
    4 {
    5 echo get_class($this);
    6 }
    7 }
    8 $cl = new Insurance();
    9 $cl->clsName();
    10 Insurance::clsName();

    Which of the following code line(s) should be commented to print the class name without errors?


  • Which of the following statements is NOT correct for PHP?


  • In your PHP application you need to open a file. You want the application to issue a warning and continue execution, in case the file is not found. The ideal function to be used is:


  • Which of the following is used to maintain the value of a variable over different pages?


  • The value of a local variable of a function has to be retained over multiple calls to that function. How should that variable be declared?