php mcq questions with answers


                                
What method can be used to find a tag with the name "foo" via the DOM extension?
A.getElementById()
B.getElementsByTagName()
C.getElementsByTagNameNS()
D.getElementByName()
E.findTag()
                                
Which of the following statements is NOT true? a) Class constants are public b) Class constants are being inherited c) Class constants can omit initialization (default to NULL) d) Class constants can be initialized by consts
A.a)
B.b)
C.c)
D.d)
                                
Assume that you are using PHP s session management without cookies and want to make sure that session information does not get lost when redirecting the client to another URLWhich of the following functions do you need to achieve that? (Choose 3)
A.header()
B.session_id()
C.session_info()
D.session_name()
E.session_write_close()
                                
An object can be counted with count() and sizeof() if it
A.implements ArrayAccess
B.has a public __count() method
C.was cast to an object from an array
D.None of the above
                                
Which of the listed changes would you make to the following PHP 4 code in order to make it most compliant with PHP 5? (Choose 2) <?php class Car { var $model; function Car($model) { $this->model = $model; } function toString() { return "I drive a $this->model."; } } $c = new Car('Dodge'); echo $c->toString(); ?>
A.Change var to public or private
B.Change function Car to function_construct
C.Change "I drive a $this->model." to "I drive a {$this->model}."
D.Change function toString()to static function toString()