0% found this document useful (0 votes)
1K views

Multiple Choice Question On PHP

This document contains a multiple choice quiz about PHP with 25 questions. The questions cover topics like what PHP stands for, who created PHP, PHP features like loops and exceptions, object oriented programming concepts in PHP, and PHP configuration directives. Answer options are provided for each multiple choice question.

Uploaded by

Sonabose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views

Multiple Choice Question On PHP

This document contains a multiple choice quiz about PHP with 25 questions. The questions cover topics like what PHP stands for, who created PHP, PHP features like loops and exceptions, object oriented programming concepts in PHP, and PHP configuration directives. Answer options are provided for each multiple choice question.

Uploaded by

Sonabose
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Multiple Choice Question on Php

1. What does PHP stand for?


i) Personal Home Page ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor iv) Preprocessor Home Page
 Both (i) and (ii)
 Both (ii) and (iv)
 Only (ii)
 Both (i) and (iii)
2. Who is the father of PHP?
 Rasmus Lerdorf
 Willam Makepiece
 Drek Kolkevi
 List Barely
3. Which of the looping statements is/are supported by PHP?
i) for loop ii) while loop
iii) do-while loop iv) foreach loop
 (i) and (ii)
 (i), (ii) and (iii)
 All of the mentioned
 None of the mentioned
4. Which version of PHP introduced Try/catch Exception?
 PHP 4
 PHP 5
 PHP 5.3
 PHP 6
5. We can use ___ to comment a single line?
i) /? ii) //
iii) # iv) /* */
 Only (ii)
 (i), (iii) and (iv)
 (ii), (iii) and (iv)
 Both (ii) and (iv)
6. Which statement will output $x on the screen?
 echo “\$x”;
 echo “$$x”;
 echo “/$x”;
 echo “$x;
7. Which of the following statements is/are true about Constructors in PHP?
(i) PHP 4 introduced class constructors. (ii) Constructors can accept parameters.
(iii) Constructors can call class methods or other functions
(iv) Class constructors can call on other constructors.
 (ii) and (iii)
 All of the mentioned
 None of the mentioned
 (ii), (iii) and (iv)
8. PHP recognizes constructors by the name.
 classname()
 _construct()
 function _construct()
 function __construct()
9. Which one of the following functions is used to determine whether a class exists?
 exist()
 exist_class()
 class_exist()
 __exist()
10. Which of the following advanced OOP features is/are not supported by PHP?
i) Method overloading
ii) Multiple Inheritance
iii) Namespaces
iv) Object Cloning
 i)
 ii)
 i) and ii)
 iii) and iv)
11. Which one of the following is the right way to clone an object?
 _clone(targetObject);
 destinationObject = clone targetObject;
 destinationObject = _clone(targetObject);
 destinationObject = clone(targetObject);
12. Which of the following is/are true for an abstract class?
i) Abstract classes in PHP are declared with the help of abstract keyword.
ii) A class is declare abstract by using the keyword implements.
iii) It is a class that really isn’t supposed to ever be instantiated but instead serves as a base class.
iv) Attempting to instantiate an abstract class results in an error.
 Only i)
 Only iii)
 ii) and iv)
 ii), iii) and iv)
13. If one intends to create a model that will be assumed by a number of closely related objects, which
class must be used?
 Normal class
 Static class
 Abstract class
 Interface
14. Which feature allows us to call more than one method or function of the class in single instruction?
 Typecasting
 Method Including
 Method adding
 Method chaining
15. What is the description of Error level E_ERROR?
 Fatal run-time error
 Near-fatal error
 Compile-time error
 Fatal Compile-time error
16. Say you want to report error concerned about fatal run-time, fatal compile-time error and core error
which statement would you use?
 error_reporting = E_ALL
 error_reporting = E_ERROR | E_PARSE | E_CORE_ERROR
 error_reporting = E_ERROR | E_COMPILE_WARNING | E_CORE_ERROR
 error_reporting = E_ERROR | E_COMPILE_ERROR | E_CORE_ERROR
17. How many methods are available for the exception class?
 5
 6
 7
 8
18. How many predefined exceptions does SPL provide access to?
 13
 14
 15
 16
19. Which one of the following does not describe a validating filter?
 Are used to allow or disallow specific characters in a string
 Are used to validate user input
 Strict format rules
 Returns the expected type on success or FALSE on failure
20. What will be the output of the following PHP code?
<?php
$num = "123";
if (!filter_var($num, FILTER_VALIDATE_INT))
echo("Integer is not valid");
else
echo("Integer is valid");
?>
 No output is returned
 Integer is not valid
 Integer is valid
 Error
21. Which one of the following filter checks if the variable of the specified type exists?
 filter_has_var
 filter_var
 filter_id
 filter_var_array
22. Which one of the following statements should be used to disable the use of two classes administrator
and janitor?
 disable_classes = “administrator, janitor”
 disable_classes = class administrator, class janitor
 disable_classes = class “administrator”, class “janitor”
 disable_class = class “administrator”, class “janitor”
23. How many configuration directives pertinent to PHP’s mail function are available?
 4
 5
 6
 7
24. What is the default value of the directive max_file_limit?
 10 files
 15 files
 20 files
 25 files
25. What will be the output of the following PHP code? (Before the version PHP 5.2)
class StringThing {}
$st = new StringThing();
print $st;
 Object Not Found
 Object id #1
 PHP Catchable fatal error
 Cannot initialize object

You might also like