php mcq questions with answers


                                
What is the result of the following code? define('PI', 3.14); class T { const PI = PI; } class Math { const PI = T::PI; } echo Math::PI;
A.Parse error
B.3.14
                                
What is the file locking mode that should be used when writing to a file?
A.LOCK_UN
B.LOCK_SH
C.LOCK_EX
D.LOCK_NB
                                
Which of the following techniques ensures that a value submitted in a form can only be yes or no?
A.Use a select list that only lets the user choose between yes and no.
B.Use a hidden input field that has a value of yes or no.
C.Enable the safe_mode configuration directive.
D.None of the above.
                                
How many times will the function counter() be executed in the following code? function counter($start, &$stop) { if ($stop > $start) { return; } counter($start--, ++$stop); } $start = 5; $stop = 2; counter($start, $stop);
A.3
B.4
C.5
D.6
                                
Is the following code piece E_STRICT compliant? final class Testing { private $test; public function tester() { return "Tested!"; } }
A.Yes
B.No