php mcq questions with answers


                                
An HTML form contains this form element: <input type="file" name="myFile" /> When this form is submitted, the following PHP code gets executed: <?php move_uploaded_file( $_FILES['myFile']['tmp_name'], 'uploads/' $_FILES['myFile']['name']); ?> Which of the following actions must be taken before this code may go into production? (Choose 2)
A.Check with is_uploaded_file() whether the uploaded file $_FILES['myFile']['tmp_name'] is valid
B.Sanitize the file name in $_FILES['myFile']['name'] because this value is not consistent among web browsers
C.Check the charset encoding of the HTTP request to see whether it matches the encoding of the uploaded file
D.Sanitize the file name in $_FILES['myFile']['name'] because this value could be forged
E.Use $HTTP_POST_FILES instead of $_FILES to maintain upwards compatibility
                                
Given the following two functions, what statement is correct? function dynamicNew($name) { return new $name; } function reflectionNew($name) { $r = new ReflectionClass($name); return $r->newInstanceArgs(); }
A.Both functions do the same
B.dynamicNew() results in a parse error, reflectionNew() works
                                
What is the output of the following code? echo "22" + "0.2", 23 1;
A.220.2231
B.22.2231
C.22.2,231
D.56.2
                                
What can prevent PHP from being able to open a file on the hard drive (Choose 3)?
A.File system permissions
B.File is outside of open_basedir
C.File is owned by another user and safe_mode is enabled.
D.File is inside the /tmp directory.
E.PHP is running as the web server user.
                                
Which methods can be used to overload object properties? (Choose 2)
A.set(), get()
B.__set(), __get()
C.__put(), __receive(), __exists()
D.set(), get(), isset()
E.__isset(), __unset()