php mcq questions with answers


                                
The constructs for(), foreach(), and each() can all be used to iterate an object if the object
A.implements ArrayAccess
B.implements Iterator
C.implements Iterator and ArrayAccess
D.None of the above
                                
What is the difference between isset() and other is_*() functions (is_alpha(), is_number(), etc.)?
A.isset() is a function call and is_*() are not function calls
B.is_*() are language constructs and isset() is not a language construct
C.c) isset() is a language construct and is_*() are not language constructs
D.d) is_*() return a value whereas isset() does not
                                
What function should be used to escape command line arguments that are passed to commands executed from PHP?
A.addslashes()
B.quotemeta()
C.escapeshellarg()
D.escapeshellcmd()
E.passthru()
                                
The following code piece should print "PHP is cool", but unexpectedly, it just prints "cool"How would you correct it? echo str_replace('PHP is a pain.', 'a pain', 'cool');
A.str_replace('PHP is a pain.', 'cool', 'a pain');
B.str_replace('a pain', 'cool', 'PHP is a pain.');
C.str_replace('cool', 'a pain', 'PHP is a pain.');
                                
Which of the following statements about Reflection are correct? (Choose 2)
A.Since 5.1 reflection is an extension that can be disabled
B.Reflection is present in any installation of PHP 5 or later
C.Reflection only allows to reflect on built-in classes
D.Built-in classes can be reflected on command line using php rc <classname>