PHP MCQ With Answers
PHP: Hypertext Preprocessor
- Open-source, server-side scripting language
- Used to generate dynamic web-pages
- PHP scripts reside between reserved PHP tags
- This allows the programmer to embed PHP scripts within HTML pages.
- It is interpreted language, scripts are parsed at run-time rather than compiled beforehand.
- Executed on the server-side.
- Source-code not visible by the client.
- -’ View Source’ in browsers does not display the PHP code.
- Various built-in functions allow for fast development.
- Compatible with many popular databases
- Supports procedural and object-oriented paradigm.
- All PHP statements end with a semi-colon.
- Each PHP script must be enclosed in the reserved PHP tag.
Variables in PHP:
- PHP variables must begin with a “$” sign.
- Case-sensitive($Res != $res != $rEs)
- Globally and locally scoped variables
- Global variables can be used anywhere.
- Local variables are restricted to a function or class.
- Certain variabe names reserved by PHP
- Form variables($_POST, $_GET)
- Server variables($_SERVER)
Important Resources
- PHP Developer
- PHP Projects With Source Code
- PHP Developer Salary
- Features of PHP
- PHP Frameworks
- Top PHP IDE
- Difference Between PHP 5 and 7
PHP MCQs
Total error levels available in PHP are?
Identify the function which is used to compress a string.
Identify the options among the following which generates unique ids
Identify the options among the following which invokes the exception class.
Identify the property scope not supported by PHP.
Identify the regular expression which matches any expression string having zero or one P?
In PHP, how are constructors recognized?
In PHP, variable names must start with which of the following.
In which version of PHP was Type Hinting introduced?
Index of an array by default starts with which of the following in PHP?
Is PHP variable case sensitive?
The function FILESIZE() returns the size of the file in?
To implement overloading, which of the following magic method used?
Identify the function which converts a string to uppercase.
Total looping techniques supported by PHP are?
Total types of filtering present in PHP?
Total types of the array in PHP is?
Total variable scope in PHP is?
Total ways in which user a print output in PHP is -
trim() in PHP is used for?
Using which keyword is the object created?
What type of language is PHP?
Which of the following function is used to sort array in descending order?
Which of the following function is used to sort arrays in the natural order?
Which of the following is used to find files?
Error level E_ERROR denotes?
Among the following functions, choose the one which accepts any number of parameters.
Among the following options, choose the term which is used to refer to methods within the class itself.
Another name of the constructor is?
Another term used for Objects is?
Choose the correct syntax of PHP.
Choose the correct way to invoke a method among the following.
Choose the default file extension of PHP among the following.
Choose the equivalent of the statement : $sub -= $sub.
Choose the incorrect data type among the following.
Choose the option which prevents a method from being overridden by a subclass?
Choose whether true or false: the do-while loop is an exit control loop.
Choose whether true or false: while loop is an exit control loop.
Among echo and print, which is faster?
Find the output of the code below:
<?PHP
ECHO CHR(52);
?>
Find the output of the code below:
<?PHP
ECHO ORD(“HI”);
?>
Find the output of the code below:
<?PHP
$arr = ARRAY(12,5,2);
ECHO (ARRAY_PRODUCT($A));
?>
From which of the following class does the child class inherits?
- Child class
- Super class
- Base class
- Parent class
Full form of PHP is?
Full form of POSIX is?
Full form of SPL is?
Functions in PHP should start with which of the following keyword?
Identify the feature, which allows calling one or more methods or functions in single instruction?
Identify the function among the following, which is not built-in.
Identify the function which adds a value at the end of an array?