Question 1. Which one of the following is the right way of defining a function in PHP?
function { function body }
data type functionName(parameters) { function body }
functionName(parameters) { function body }
function fumctionName(parameters) { function body }
Explanation:-
Answer: Option D. -> function fumctionName(parameters) { function body }
Question 2. What will happen in this function call?
Call By Value
Call By Reference
Default Argument Value
Type Hinting
Explanation:-
Answer: Option A. -> Call By Value When you pass an argument in the above manner or say we pass 15 and 3 directly, it is called passing by value or call by value.
Question 3. Type Hinting was introduced in which version of PHP?
PHP 4
PHP 5
PHP 5.3
PHP 6
Explanation:-
Answer: Option B. -> PHP 5 Type hinting gives you the ability to force parameters to be objects of certain class or to be arrays. PHP 5 introduced this feature.
Question 4. What will be the output of the following PHP code?
Error
0
42
84
Explanation:-
Answer: Option C. -> 42 You can designate certain arguments as optional by placing them at the end of the list and assigning them a default value of nothing.
Question 5. Which of the following are valid function names? 1. function() 2. €() 3. .function() 4. $function()
Only 2
None of the mentioned
All of the mentioned
3 and 4
Explanation:-
Answer: Option A. -> Only 2 Except a) others are invalid names. According to the specified regular expression ([a-zA-Z_x7f-xff][a-zA-Z0-9_x7f-xff]*), a function name like this one is valid.
Question 6. What will be the output of the following PHP code ?
o world!
Hello world!
111
No Output
Explanation:-
Answer: Option A. -> o world! 111 is the ASCII value of o.
Question 7. Phpinfo() will display about? 1. OS version information 2. PHP installation 3. Variables 4. HTTP headers
Option 1
Option 2
Option 3
Option 4
All the Above
Explanation:-
Answer: Option E. -> All the Above
Question 8. . . . . . converts the keys of an array into values and the values into keys.
array_flips()
array_transpose()
array_trans()
array_flip()
Explanation:-
Answer: Option D. -> array_flip()
Question 9. Above usleep() function pauses PHP for . usleep(1000000);