PHP/PHP Mcq ��� Error Handling Sample Test,Sample questions

Question:
  Which version of PHP introduced E_STRICT Error level?

1. PHP 4

2.PHP 5

3.PHP 5.2

4.PHP 5.3


Question:
 If the input variable is a string like this “http://www.saåånfoøøundry.com/”, the $url variable after the sanitizing will look like?

1. http://www.saåånfoøøundry.com/

2.http://www.saaanfoooundry.com/

3.http://www.saånfoøundry.com/

4. https://www.sanfoundry.com/


Question:
 PHP has long supported two regular expression implementations known as _______ and _______

i) Perl
ii) PEAR
iii) Pearl
iv) POSIX

1.i) and ii)

2. ii) and iv)

3.i) and iv)

4.ii) and iii)


Question:
 What will be the output of the following PHP code?

    <?php
    $value = 'car';
    $result = filter_var($value, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE);
    ?>

1.FALSE

2.TRUE

3.NULL

4.fERROR


Question:
 Which function initializes the constants necessary for using the openlog(), clodelog(), and syslog() functions?

1. define_variable()

2.define_log_variable()

3. log_variable()

4.define_syslog_variable()


Question:
 Which logging option’s description is if an error occurs when writing to the syslog, send output to the system console?
 

1.LOG_CONS

2.LOG_NDELAY

3.LOG_ODELAY

4.LOG_PERROR


Question:
 Which of the following is/are an external data?

i) Cookies
ii) Input data from a form
iii) Server Variables
iv) Web services data

1.Only ii)

2. ii) and iii)

3.Only iii)

4.i), ii), iii) and iv)


Question:
How many error levels are available in PHP?

1.14

2.15

3.16

4.17


Question:
How many methods are available for the exception class?

1.5

2.6

3.7

4.8


Question:
Say you want to report error concerned about fatal run-time, fatal compile-time error and core error which statement would you use?

1. a) error_reporting = E_ALL

2.error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR

3.error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR

4.error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR


Question:
What will be the output of the following PHP code?

    <?php
    $username = "jasoN";
    if (ereg("([^a-z])",$username))
        echo "Username must be all lowercase!";
    else
        echo "Username is all lowercase!";
    ?>

1.Error

2.Username must be all lowercase!

3.Username is all lowercase!

4.No Output is returned


Question:
What will be the output of the following PHP code?

    <?php
    $var=300;
    $int_options = array("options"=>array ("min_range"=>0, "max_range"=>256));
    if (!filter_var($var, FILTER_VALIDATE_INT, $int_options))
        echo("Integer is not valid");
    else
        echo("Integer is valid");
    ?>

1.No output is returned b) c) d)

2.Integer is not valid

3.Integer is valid

4.Error


Question:
What will be the output of the following PHP code?

    <?php
    function convertSpace($string)
    {
        return str_replace("_", " ", $string);
    }
    $string = "Peter_is_a_great_guy!";
    echo filter_var($string, FILTER_CALLBACK, array("options"=>"convertSpace"));
    ?>

1.Peter_is_a_great_guy!

2.Peterisagreatguy

3.Peter is a great guy!

4.Error


Question:
Which function is responsible for sending a custom message to the system log?

1.systemlog()

2.syslog()

3.log_system()

4.sys_log()


Question:
Which of the following statements causes PHP to disregard repeated error messages that occur within the same file and on the same line?

1. ignore_repeated_errors

2. ignore_repeat_error

3. repeatedly_ignore_error

4.repeated_error_ignore


Question:
Which one of the following does not describe a validating filter?

1.Are used to allow or disallow specific characters in a string

2.Are used to validate user input

3.Strict format rules

4.Returns the expected type on success or FALSE on failure


Question:
Which one of the following filter is used to filter several variables with the same or different filters?

1. filter_var_array()

2.filter_var()

3.filter_input

4. filter_input_array


Question:
Which version introduced the function error_get_last()?
 

1.PHP 4

2.PHP 5

3.PHP 5.2

4.PHP 5.3


Question:
Which version of PHP was added with Exception handling?

1.PHP 4

2.PHP 5

3.PHP 5.3

4. PHP 6


Question:
[:alpha:] can also be specified as ________

1.[A-Za-z0-9]

2.[A-za-z]

3. [A-z]

4.[a-z]


More MCQS

  1. PHP Mcq Set 1
  2. PHP Mcq Set 2
  3. PHP Mcq Set 3
  4. PHP Mcq Set 4
  5. Current affairs mcq php
  6. Current affairs mcq php set 2
  7. Current affairs mcq php set 3
  8. PHP MCQ
  9. PHP MCQ– Basics
  10. PHP Mcq – Functions
  11. PHP Mcq Arrays
  12. PHP Mcq– Basics of Object-Oriented PHP
  13. PHP Mcq – Error Handling
  14. PHP Basics Mcq Questions
Search
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!