Instruction
- Total number of questions : 20.
- Time alloted : 20 minutes.
- Each question carry 1 mark.
- No Negative marks
- DO NOT refresh the page.
- All the best :-).
1. |
PHP files have a default file extension of.. |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None. |
2. |
What will be the output of the following code? <?php $foo = 'Bob'; $bar = &$foo; $bar = "My name is $bar"; echo $bar; echo $foo; ?>
|
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The $bar = &$foo; line will reference $foo via $bar. |
3. |
Which of the below symbols is a newline character? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: PHP treats \n as newline character. |
4. |
Type Hinting was introduced in which version of PHP? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: Type hinting gives you the ability to force parameters to be objects of certain class or to be arrays. PHP 5 introduced this feature. |
5. |
Which one of the following PHP functions can be used to find files? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: Here is an example- |
6. |
Which of the following are correct ways of creating an array? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: A variable name should start with $ symbol which is not present in i) and you need not put the square brackets when you use the array() constructor. |
7. |
What will be the output of the following PHP code ? <?php $a1 = array("a" => "red", "b" => "green", "c" => "blue", "d" => "yellow"); $result = array_flip($a1); print_r($result); ?> |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The array_flip() function flips/exchanges all keys with their associated values in an array. |
8. |
What will be the output of the following PHP code? <?php $age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); print_r(array_change_key_case($age, CASE_UPPER)); ?> |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The array_change_key_case() function changes all keys in an array to lowercase or uppercase. |
9. |
Which of the functions is used to sort an array in descending order? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: sort() function is used to sort in ascending order where as rsort() meaning reverse sort is used for sorting in descending order. |
10. |
Which of the following term originates from the Greek language that means “having multiple forms,” defines OOP’s ability to redefine, a class’s characteristics? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
11. |
Which of the following statements is/are true about Constructors in PHP? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
12. |
Which version of PHP introduced the advanced concepts of OOP? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: None. |
13. |
What is the description of Error level E_ERROR? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option A Explanation: None. |
14. |
How many methods are available for the exception class? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The seven methods are: getCode(), getFile(), getLine(), getMessage(), getPrevious(), getTrace(), getTraceAsString() |
15. |
How many types of filtering are present in PHP? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: There are two main types of filtering: validation and sanitization. |
16. |
Which one of the following regular expression matches any string containing zero or one p? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: None |
17. |
What will be the output of the following PHP code? <?php $foods = array("pasta", "steak", "fish", "potatoes"); $food = preg_grep("/^s/", $foods); print_r($food); ?> |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: This function is used to search an array for foods beginning with s. |
18. |
Which one of the following PHP function is used to determine a file’s last access time? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option C Explanation: The fileatime() function returns a file’s last access time in Unix timestamp format or FALSE on error. |
19. |
The date() function returns ___ representation of the current date and/or time. |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option B Explanation: The prototype of this function is: string date(string format [, int timestamp]) |
20. |
How many constants does the DateTime class have? |
|||||||||||||||||||
Your Answer: Option (Not Answered) Correct Answer: Option D Explanation: The DateTime class has 11 constants, no static properties or methods. |