PHP 5 Quiz # 8

Instructions
Quiz: PHP 5 Quiz # 8
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 # 8
Question 1 of 30
00:00
  • What will be the result of the following expression:
    6+4 * 9-3


  • Which of the following statements is not true with regard to abstract classes in php5?


  • Which of the following printing constructs/functions accept(s) multiple parameters?


  • Which of the following variable declarations within a class is invalid in PHP5?


  • Which of the following is not a file related function in PHP?


  • Which of the following is an iterator class included in Standard PHP Library (SPL) in PHP5?


  • What will be the output of the following code?

    $var = 10;
    function fn()
    {
       $var = 20;
       return $var;
    }
    fn();
    echo $var;


  • Which of the following PHP syntax depictions is/are incorrect?


  • What will be the output of the following code?

    $a = 10;
    if($a > 5 OR < 15)
      echo "true";
    else
      echo "false"

  • You have two strings, which you want to concatenate.

    $str1 = 'Have a ';
    $str2 = 'Nice Day';

    The fastest way would be:


  • Which of the following characters are taken care of by htmlspecialchars?


  • Does PHP 5 support exceptions?


  • Which of the following is a PHP resource?


  • Which of the following is correct with regard to echo and print ?


  • Which of the following are the valid PHP data types?


  • What will be the output of the following code?

    $Rent = 250;
    function Expenses($Other)
    {
       $Rent = 250 + $Other;
       return $Rent;
    }
    Expenses(50);
    echo $Rent;

  • Which of the following types are supported by 'str_replace()' function?


  • You need to check the size of a file in PHP function.

    $size=X(filename);

    Which function will suitably replace 'X'?


  • Which of the following text manipulation functions is supported by PHP?


  • Which of the following environment variables is used to fetch the IP address of the user in your PHP application?


  • What do you infer from the following code?

    <?php
            $str = 'Dear Customer,\nThanks for your query. We will reply very soon.?\n Regards.\n Customer Service Agent';
            print $str;
    ?>


  • Does PHP provide the goto keyword in latest version?


  • You have defined three variables $to, $subject, and $body to send an email. Which of the following methods would you use for sending an email?


  • What will be the output of the following code?

    function fn(&$var)
    {
       $var = $var - ($var/10 * 5);
       return $var;
    }
    echo fn(100);


  • What will be the output of the following code?

    <?php
    var_dump (3*4);
    ?>


  • You need to keep an eye on the existing number of objects of a given class without introducing a non-class member variable. Which of the following makes this happen?


  • Which of the following is not supported in PHP5?


  • We have two variable definitions:

    1. 023
    2. x23

    Choose the correct options:


  • Which of the given statements is correct about the following PHP 7.1 code snippet?

    function example() {

    foreach (range(5, 7) as $a){yield;

    }

    }

    var_dump(iterator_to_array(example()));

    ?>

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

    interface exp1

    {

    const c = }

    echo exp1 ::c;

    class exp2 implements exp1

    {

    const c = 'Second Example';

    }

    echo exp2::c;

    ?>