php mcq questions with answers


                                
Which of the following may be used in conjunction with CASE inside a SWITCH statement?
A.A scalar
B.An expression
C.A boolean
D.All of the above
                                
You need to escape special characters to use user input inside a regular expressionWhich functions would you use? (Choose 2)
A.addslashes()
B.htmlentities()
C.preg_quote()
D.regex_quote()
E.quotemeta()
                                
What is the ideal method of copying data between two opened files?
A.copy($source_file, $destination_file);
B.copy(destination_file, $source_file);
C.stream_copy_to_stream($source_file, $destination_file);
D.stream_copy_to_stream($destination_file, $source_file);
E.stream_bucket_prepend($source_file, $destination_file);
                                
Which sentence describes the following regular expression match? preg_match('/^\d*(?:\.[0-9]+)?$/', $test);
A.It matches float numbers with thousand separators.
B.It matches float numbers without thousand separators.
C.It matches binary integer numbers.
D.It matches any string.
E.It does not match anything
                                
Which of the following did not result in an output error in PHP 4 but does in PHP 5?:
A.Using 'var' as an access modifier.
B.Assigning a new object instance to $this in a constructor.
C.Passing an object by-reference.
D.Passing an object by-value.