62. The ____ pattern is extremely useful for creating objects which watch the state of other objects and respond to those ...
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Upcoming SlideShare
Loading in …5
×

Php5 certification mock exams

3,204 views

Published on

Php5 certification mock exams

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,204
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
208
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Php5 certification mock exams

  1. 1. 62. The ____ pattern is extremely useful for creating objects which watch the state of other objects and respond to those changes.<br />Answer: Observer<br /> <br />63. In databased that do not support the AUTO_INCREMENT modifier, you must use a ____ instead to auto-generate a numeric incrementing key<br />Answer: LAST_INSERT_ID<br /> <br />64. <br /><?php<br />$array = array(<br />            "a"=>"John",<br />            "b"=>"Coggeshall",<br />            "c"=>array(<br />                "d"=>"John",<br />                "e"=>"Smith"<br />            )<br />        );<br /> <br />function something($array)<br />{<br />    extract($array);<br />    return $c['e'];<br />}<br />print something($array);<br />?><br />A. Smith<br />B. A PHP Warning<br />C. Coggeshall<br />D. NULL<br />E. Array<br />Answer: A<br /> <br />65. What does the following function do, when passwd two integer values for $p and $q?<br /><?php<br />function magic($p, $q)<br />{<br />    return ($q == 0) ? $p : magic($q, $p % $q);<br />}<br />?><br />A. Loops infinitely<br />B. Switches the values of $p and $q<br />C. Determines if they are both even or odd<br />D. Determines the greatest common divisor between them<br />E. Calculates the modulus between the two<br />Answer: E<br /> <br />66. When running PHP in a shared host environment, what is the major security concern when it comes to session data?<br />A. Sessions on shared hosts are easily hijacked by outside malicious users<br />B. All of the above<br />C. You cannot use a custom data sotre in shared hosts<br />D. Session data stored in the file system can be read by other scripts on the same shared host<br />E. Users outside the shared host can access any site which created a session for them<br />Answer: D<br /> <br />67. Which of teh following functions will sort an array in ascending order by value, while preserving key associations?<br />A. asort()<br />B. usort()<br />C. krsort()<br />D. ksort()<br />E. sort()<br />Answer: A<br /> <br />68. When executing system commands from PHP, what should one do to keep applications secure? (choose 3)<br />A. Remove all quote characters from variables used in a shell execution<br />B. Avoid using shell commands when PHP equivlents are available<br />C. Hard code all shell commands<br />D. Escape all shell arguments<br />E. Escape all shell commands executed<br />Answer: BCD<br /> <br />69. Which of the following functions will trim leading and/or trailing white space from a string? (choose 3)<br />A. ltrim()<br />B. rtrim()<br />C. wtrim()<br />D. trim()<br />E. str_replace()<br />Answer: ABD<br /> <br />70. Which of the following is not a valid fopen() access mode:<br />A. b<br />B. x<br />C. a<br />D. w<br />E. r+<br />Answer: A<br />It may be any of the following: <br />‘r’   Open for reading only; place the file pointer at the beginning of the file.<br />‘r+’ Open for reading and writing; place the file pointer at the beginning of the file.<br />‘w’ Open for writing only; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.<br />‘w+’ Open for reading and writing; place the file pointer at the beginning of the file and truncate the file to zero length. If the file does not exist, attempt to create it.<br />‘a’ Open for writing only; place the file pointer at the end of the file. If the file does not exist, attempt to create it.<br />‘a+’ Open for reading and writing; place the file pointer at the end of the file. If the file does not exist, attempt to create it.<br />‘x’ Create and open for writing only; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call.<br />‘x+’ Create and open for reading and writing; place the file pointer at the beginning of the file. If the file already exists, the fopen() call will fail by returning FALSE and generating an error of level E_WARNING. If the file does not exist, attempt to create it. This is equivalent to specifying O_EXCL|O_CREAT flags for the underlying open(2) system call. <br /> <br />71. You can determine if you can seek an arbitrary stream in PHP with the ____ function?<br />Answer: stream_get_meta_data<br /> <br />72. <br /><?php<br />session_start();<br />if(!empty($_REQUEST['id']) && !empty($_REQUEST['quantity']))<br />{<br />    $id = scrub_id($_REQUEST['id']);<br />    $quantity = scrub_quantity($_REQUEST['quantity']);<br />    $_SESSION['cart'][] = array(‘id’=>$id, ‘quantity’=>$quantity);<br />}<br />/* … */<br />?><br />What potential security hole would this code snippet produce?<br />A. Cross-Site Scripting Attack<br />B. There is no security hole in this code<br />C. Code Injection<br />D. SQL Injection<br />E. Cross-Site Request Forgery<br />Answer: E<br /> <br />73. What is the primary difference between a method declared as static and a normal method?<br />A. Static methods can only be called using the :: syntax and never from an instance<br />B. Static methods do not provide a reference to $this<br />C. Static methods cannot be called from within class instances<br />D. Static methods don’t have access to the self keyword<br />E. There is no functional difference between a static and non-static method<br />Answer: A * (Or B?)<br /> <br />74. When is it acceptable to store sensitive information in an HTTP cookie?<br />A. Only under extremely controlled situations<br />B. When the cookie is sent over a secure HTTP request<br />C. When it is encrypted<br />D. It is always acceptable<br />Answer: B<br /> <br />75. which of the following are not true about streams? (choose 2)<br />A. they are always seekable<br />B. when used properly they significantly reduce memory consumption<br />C. they can be applied to any data source<br />D. they are alwyas bi-directional<br />E. they can be filtered<br />Answer: AC (I’m not sure about C or D is correct)<br /> <br />76. Which php.ini directive should be disabled to prevent the execution of a remote PHP script via an include or require construct?<br />A. You cannot disable remote PHP script execution<br />B. curl.enabled<br />C. allow_remote_url<br />D. allow_url_fopen<br />E. allow_require<br />Answer: D<br /> <br />77. The ____ error level, which must be explicitally enabled in PHP 5, will warn you of deprecated functionality that will be removed in a future PHP version.<br />Answer: E_DEPRECATED<br /> <br />78. Which of the following operations must occur prior to any output being sent to the client (assume output buffering is disabled) (choose 3)<br />A. Modifying Session Data<br />B. Processing GET or POST data<br />C. Manipulating Cookie data<br />D. Starting a Session<br />E. Sending HTTP Headers<br />Answer: ABD * (Not sure A or C is right, be sure with BD)<br /> <br />79. The following code snippet displays what for the resultant array?<br /><?php<br />$a = array(1=>0, 3=>2, 4=>6);<br />$b = array(3=>1, 4=>3, 6=>4);<br />print_r(array_intersect($a, $b));<br />?><br />A. 1=>0<br />B. 1=>3, 3=>1, 4=>3<br />C. 3=>1, 3=>2, 4=>3, 4=>5<br />D. 1=>0, 3=>2, 4=>6<br />E. An empty Array<br />Answer: E<br /> <br />80. Which of the following functions is used to determine if a given stream is blocking or not?<br />A. stream_get_blocking<br />B. stream_get_meta_data<br />C. stream_is_blocking<br />D. stream_get_blocking_mode<br />Answer: B<br />Get more Useful php certification tutorial <br />http://www.php-community.net<br />

×