PHP Questions And Answers
Here you can find PHP Questions and Answers.
Why PHP Questions and Answers Required?
In this PHP Questions and Answers section you can learn and practice PHP Questions and Answers to improve your skills in order to face technical inerview conducted by organisations. By Practicing these
interview questions, you can easily crack any Exams interview.
Where can I get PHP Questions and Answers?
AllIndiaExams provides you lots PHP Questions and Answers with proper explanation. Fully solved examples with detailed answer description. All students, freshers can download PHP Questions and
Answers as PDF files and eBooks.
How to solve these PHP Questions and Answers?
You no need to worry, we have given lots of PHP Questions and Answers and also we have provided lots of FAQ's to quickly answer the questions in the Competitive Exams interview.
PHP Questions and Answers - Chapters
- PHP Basics Questions & Answers
- Functions Questions & Answers
- Arrays Questions and Answers
- Strings & Regular Expressions Questions and Answers
- Object Oriented PHP Questions and Answers
- Exception Handling Questions and Answers
- HTML Forms Questions and Answers
- MySQL Basics Questions & Answers
- Variables Questions & Answers
PHP Basics Questions & Answers
1. What does PHP stand for?
i) Personal Home Page
ii) Hypertext Preprocessor
iii) Pretext Hypertext Processor
iv) Preprocessor Home Page
PHP Basics Questions & Answers
2. Who is the father of PHP?
PHP Basics Questions & Answers
3. PHP files have a default file extension of.
PHP Basics Questions & Answers
4. A PHP script should start with ___ and end with ___:
PHP Basics Questions & Answers
5. Which of the looping statements is/are supported by PHP?
i) for loop
ii) while loop
iii) do-while loop
iv) foreach loop
Functions Questions & Answers
1. Which one of the following PHP functions can be used to build a function that accepts any number of arguments?
Functions Questions & Answers
2. Which one of the following PHP functions can be used to find files?
Functions Questions & Answers
3. The filesize() function returns the file size in ___.
Functions Questions & Answers
4. Which one of the following PHP function is used to determine a file’s last access time?
Functions Questions & Answers
5. Which one of the following function is capable of reading a file into an array?
Arrays Questions & Answers
1. PHP’s numerically indexed array begin with position __.
Arrays Questions & Answers
2. Which of the functions is used to sort an array in descending order?
Arrays Questions & Answers
3. Which of the following are correct ways of creating an array?
(i) state[0] = “karnatakaâ€;
(ii) $state[] = array(“karnatakaâ€);
(iii) $state[0] = “karnatakaâ€;
(iv) $state = array(“karnatakaâ€);
Arrays Questions & Answers
4. What will be the output of the following PHP code?
< ?php
$fruits = array ("mango", "apple", "pear", "peach");
$fruits = array_flip($fruits);
echo ($fruits[0]);
?>
Arrays Questions & Answers
What will be the output of the following php code?
< ?php
$states = array("karnataka" => array
( "population" => "11,35,000", "captial" => "Bangalore"),
"Tamil Nadu" => array( "population" => "17,90,000",
"captial" => "Chennai") );
echo $states["karnataka"]["population"];
?>
Strings & Regular Expressions Questions and Answers
1. How many functions does PHP offer for searching and modifying strings using Perl-compatible regular expressions.
Strings & Regular Expressions Questions and Answers
2. Say we have two compare two strings which of the following function/functions can you use?
(i) strcmp()
(ii) strcasecmp()
(iii) strspn()
(iv) strcspn()
Strings & Regular Expressions Questions and Answers
3. Which one of the following functions will convert a string to all uppercase?
Strings & Regular Expressions Questions and Answers
4. What will be the output of the following PHP code?
< ?php
$title = "O'malley wins the heavyweight championship!";
echo ucwords($title);
?>
Strings & Regular Expressions Questions and Answers
5. What will be the output of the following PHP code?
< ?php
echo str_pad("Salad", 5)." is good.";
?>
Object Oriented PHP Questions and Answers
1. Which method scope prevents a method from being overridden by a subclass?
Object Oriented PHP Questions and Answers
2. 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.
Object Oriented PHP Questions and Answers
3. PHP recognizes constructors by the name.
Object Oriented PHP Questions and Answers
4. Which version of PHP introduced the instanceof keyword?
Object Oriented PHP Questions and Answers
5. Which one of the following functions is used to determine whether a class exists?
Exception Handling Questions and Answers
1. How many error levels are available in PHP?
Exception Handling Questions and Answers
2. What is the description of Error level E_ERROR?
Exception Handling Questions and Answers
3. Which version of PHP introduced E_STRICT Error level?
Exception Handling Questions and Answers
4. Which character do the error_reporting directive use to represent the logical operator NOT?
Exception Handling Questions and Answers
5. Which version of PHP was added with Exception handling?
HTML Forms Questions and Answers
1. Which two predefined variables are used to retrieve information from forms?
HTML Forms Questions and Answers
2. The attack which involves the insertion of malicious code into a page frequented by other users is known as..
HTML Forms Questions and Answers
3. When you use the $_GET variable to collect data, the data is visible to..
HTML Forms Questions and Answers
4. When you use the $_POST variable to collect data, the data is visible to..
HTML Forms Questions and Answers
5. Which variable is used to collect form data sent with both the GET and POST methods?
MySQL Basics Questions & Answers
1. Which one of the following databases has PHP supported almost since the beginning?
MySQL Basics Questions & Answers
2. The updated MySQL extension released with PHP 5 is typically referred to as..
MySQL Basics Questions & Answers
3. Which one of the following lines need to be uncommented or added in the php.ini file so as to enable mysqli extension?
MySQL Basics Questions & Answers
4. In which version of PHP was MySQL Native Driver(also known as mysqlnd) introduced?
MySQL Basics Questions & Answers
5. Which one of the following statements is used to create a table?
Variables Questions & Answers
1. What will be the output of the following PHP code ?
< ?php
one = 1;
two = 2;
three = 3;
four = 4;
echo "one / two + three / four";
?>
Variables Questions & Answers
2. What will be the output of the following PHP code ?
< ?php
$on$e = 1;
$tw$o = 2;
$thre$e = 3;
$fou$r = 4;
echo "$on$e / $tw$o + $thre$e / $fou$r" ;
?>
Variables Questions & Answers
3. What will be the output of the following PHP code ?
< ?php
$on_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo "$on_e / $tw_o + $thre_e / $fou_r" ;
?>
Variables Questions & Answers
4. What will be the output of the following PHP code ?
< ?php
$On_e = 1;
$tw_o = 2;
$thre_e = 3;
$fou_r = 4;
echo "$on_e / $tw_o + $thre_e / $fou_r";
?>
Variables Questions & Answers
What will be the output of the following PHP code ?
< ?php
echo $red ;
?>