PHP Functions - Multiple Choice Questions
1. . . . . . converts the keys of an array into values and the values into keys.
A) array_flips()
B) array_transpose()
C) array_trans()
D) array_flip()
2. usleep(1000000);
Above usleep() function pauses PHP for . . . .
A) 1 second
B) 1 microseconds
C) 10 seconds
D) 100 microseconds
3.
$array = array(0, 1, 2); $array = array_pad($array, -6, ‘NEW’);Output will be:
A) Array ( [1] => NEW [2] => NEW [3] => NEW [4] => 0 [5] => 1 [6] => 2 )
B) Array ( [-1] => NEW [-2] => NEW [-3] => NEW [-4] => 0 [-5] => 1 [-6] => 2 )
C) Array ( [0] => NEW [-1] => NEW [-2] => NEW [-3] => 0 [-4] => 1 [-5] => 2 )
D) Array ( [0] => NEW [1] => NEW [2] => NEW [3] => 0 [4] => 1 [5] => 2 )
4. phpinfo() will display about
A) OS version information
B) PHP installation
C) Variables
D) HTTP headers
5. . . . . returns a new DateTime object.
A) getdate()
B) date_create()
C) date_sunrise()
D) date()
6. It is always necessary to use parentheses with the print function.
A) True
B) False
7.
$Var = substr("abcdef", -4, 1);The above statement will return ....
A) returns "f"
B) returns "d"
C) returns "c"
D) returns "cd"
8. Returning values from functions may include .....
A) Arrays
B) Objects
C) Both A & B
D) None of above
9. The arguments in a function are evaluated from .....
A) left to right
B) right to left
C) sometimes left to right and sometimes right to left
10. strlen() returns the length of the string on success and . . . . if the string is empty.
A) -1
B) NULL
C) Garbage value
D) 0
Answers