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
Full form of PHP is?
Choose the default file extension of PHP among the following.
What type of language is PHP?
Choose the correct syntax of PHP.
Choose the equivalent of the statement : $sub -= $sub.
Total ways in which user a print output in PHP is -
Among echo and print, which is faster?
In PHP, variable names must start with which of the following.
Is PHP variable case sensitive?
Total variable scope in PHP is?
Choose the incorrect data type among the following.
Total looping techniques supported by PHP are?
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.
Identify the function among the following, which is not built-in.
Functions in PHP should start with which of the following keyword?
Total types of the array in PHP is?
Index of an array by default starts with which of the following in PHP?
trim() in PHP is used for?
Another term used for Objects is?
Using which keyword is the object created?
Another name of the constructor is?
Among the following options, choose the term which is used to refer to methods within the class itself.
In which version of PHP was Type Hinting introduced?
Among the following functions, choose the one which accepts any number of parameters.
Which of the following is used to find files?
Identify the function which is used to compress a string.
Which of the following function is used to sort array in descending order?
Choose the correct way to invoke a method among the following.
Choose the option which prevents a method from being overridden by a subclass?
In PHP, how are constructors recognized?
Identify the feature, which allows calling one or more methods or functions in single instruction?
Total error levels available in PHP are?
Error level E_ERROR denotes?
Identify the options among the following which invokes the exception class.
Identify the options among the following which generates unique ids
Find the output of the code below:
<?PHP
ECHO CHR(52);
?>
Find the output of the code below:
<?PHP
ECHO ORD(“HI”);
?>
Identify the function which adds a value at the end of an array?
Find the output of the code below:
<?PHP
$arr = ARRAY(12,5,2);
ECHO (ARRAY_PRODUCT($A));
?>
Which of the following function is used to sort arrays in the natural order?
Identify the property scope not supported by PHP.
From which of the following class does the child class inherits?
- Child class
- Super class
- Base class
- Parent class
To implement overloading, which of the following magic method used?
Full form of SPL is?
Total types of filtering present in PHP?
Identify the regular expression which matches any expression string having zero or one P?
Full form of POSIX is?
Identify the function which converts a string to uppercase.
The function FILESIZE() returns the size of the file in?