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 />
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams
Php5 certification mock exams

More Related Content

PDF
Software Vulnerabilities in C and C++ (CppCon 2018)
PDF
C++ The Principles of Most Surprise
PDF
Thoughts On Learning A New Programming Language
PDF
Secure Programming Practices in C++ (NDC Security 2018)
ODP
null Pune meet - Application Security: Code injection
PDF
Rechecking Apache HTTP Server
PDF
The Anatomy of an Exploit (CPPP 2019)
PPTX
Applying Compiler Techniques to Iterate At Blazing Speed
Software Vulnerabilities in C and C++ (CppCon 2018)
C++ The Principles of Most Surprise
Thoughts On Learning A New Programming Language
Secure Programming Practices in C++ (NDC Security 2018)
null Pune meet - Application Security: Code injection
Rechecking Apache HTTP Server
The Anatomy of an Exploit (CPPP 2019)
Applying Compiler Techniques to Iterate At Blazing Speed

What's hot (20)

PDF
Analysis of Godot Engine's Source Code
PDF
Why Windows 8 drivers are buggy
PDF
The Anatomy of an Exploit (NDC TechTown 2019)
PDF
Reading Other Peoples Code (Web Rebels 2018)
PPTX
Static code analysis: what? how? why?
PDF
Trying to learn C# (NDC Oslo 2019)
PPT
Surprise! It's PHP :) (unabridged)
PDF
Linux version of PVS-Studio couldn't help checking CodeLite
PDF
Checking 7-Zip with PVS-Studio analyzer
PDF
A Post About Analyzing PHP
PDF
Architecture for Massively Parallel HDL Simulations
PDF
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
PDF
One definition rule - что это такое, и как с этим жить
PPT
Unit Testing using PHPUnit
PPT
Handling Exceptions In C &amp; C++[Part A]
PPTX
Exploit Research and Development Megaprimer: Win32 Egghunter
PPTX
Python Programming Essentials - M21 - Exception Handling
PPT
Phpunit testing
PPTX
Python Programming Essentials - M16 - Control Flow Statements and Loops
PPT
Test Driven Development with PHPUnit
Analysis of Godot Engine's Source Code
Why Windows 8 drivers are buggy
The Anatomy of an Exploit (NDC TechTown 2019)
Reading Other Peoples Code (Web Rebels 2018)
Static code analysis: what? how? why?
Trying to learn C# (NDC Oslo 2019)
Surprise! It's PHP :) (unabridged)
Linux version of PVS-Studio couldn't help checking CodeLite
Checking 7-Zip with PVS-Studio analyzer
A Post About Analyzing PHP
Architecture for Massively Parallel HDL Simulations
DEF CON 23 - COLIN O'FLYNN - dont whisper my chips
One definition rule - что это такое, и как с этим жить
Unit Testing using PHPUnit
Handling Exceptions In C &amp; C++[Part A]
Exploit Research and Development Megaprimer: Win32 Egghunter
Python Programming Essentials - M21 - Exception Handling
Phpunit testing
Python Programming Essentials - M16 - Control Flow Statements and Loops
Test Driven Development with PHPUnit
Ad

Similar to Php5 certification mock exams (20)

PDF
501 - PHP MYSQL.pdf
PDF
Zend Certification PHP 5 Sample Questions
PDF
PHP Technical Questions
DOCX
Php questions and answers
PPTX
OPEN SOURCE WEB APPLICATION DEVELOPMENT question
PDF
Php interview questions with answer
PPTX
Creating "Secure" PHP Applications, Part 1, Explicit Code & QA
PPTX
PHP Session - Mcq ppt
KEY
Can't Miss Features of PHP 5.3 and 5.4
PDF
08 Advanced PHP #burningkeyboards
DOCX
Php interview questions
PDF
Php Crash Course - Macq Electronique 2010
PDF
PHP Reviewer
DOC
Oss questions
PPTX
25 php interview questions – codementor
PPTX
Unit 4-6 sem 7 Web Technologies.pptx
PDF
Php interview questions
PDF
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
501 - PHP MYSQL.pdf
Zend Certification PHP 5 Sample Questions
PHP Technical Questions
Php questions and answers
OPEN SOURCE WEB APPLICATION DEVELOPMENT question
Php interview questions with answer
Creating "Secure" PHP Applications, Part 1, Explicit Code & QA
PHP Session - Mcq ppt
Can't Miss Features of PHP 5.3 and 5.4
08 Advanced PHP #burningkeyboards
Php interview questions
Php Crash Course - Macq Electronique 2010
PHP Reviewer
Oss questions
25 php interview questions – codementor
Unit 4-6 sem 7 Web Technologies.pptx
Php interview questions
Top 100-php-interview-questions-and-answers-are-below-120816023558-phpapp01
Ad

Recently uploaded (20)

PDF
Auditboard EB SOX Playbook 2023 edition.
PDF
Introduction to MCP and A2A Protocols: Enabling Agent Communication
DOCX
Basics of Cloud Computing - Cloud Ecosystem
PPTX
Training Program for knowledge in solar cell and solar industry
PDF
A symptom-driven medical diagnosis support model based on machine learning te...
PDF
Co-training pseudo-labeling for text classification with support vector machi...
PDF
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
PDF
Lung cancer patients survival prediction using outlier detection and optimize...
PDF
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
PDF
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
PDF
4 layer Arch & Reference Arch of IoT.pdf
PDF
Build Real-Time ML Apps with Python, Feast & NoSQL
PDF
LMS bot: enhanced learning management systems for improved student learning e...
PDF
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
PPTX
Build automations faster and more reliably with UiPath ScreenPlay
PDF
Connector Corner: Transform Unstructured Documents with Agentic Automation
PDF
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
PDF
The AI Revolution in Customer Service - 2025
PDF
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
PDF
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC
Auditboard EB SOX Playbook 2023 edition.
Introduction to MCP and A2A Protocols: Enabling Agent Communication
Basics of Cloud Computing - Cloud Ecosystem
Training Program for knowledge in solar cell and solar industry
A symptom-driven medical diagnosis support model based on machine learning te...
Co-training pseudo-labeling for text classification with support vector machi...
zbrain.ai-Scope Key Metrics Configuration and Best Practices.pdf
Lung cancer patients survival prediction using outlier detection and optimize...
Transform-Your-Factory-with-AI-Driven-Quality-Engineering.pdf
INTERSPEECH 2025 「Recent Advances and Future Directions in Voice Conversion」
4 layer Arch & Reference Arch of IoT.pdf
Build Real-Time ML Apps with Python, Feast & NoSQL
LMS bot: enhanced learning management systems for improved student learning e...
Transform-Your-Supply-Chain-with-AI-Driven-Quality-Engineering.pdf
Build automations faster and more reliably with UiPath ScreenPlay
Connector Corner: Transform Unstructured Documents with Agentic Automation
Planning-an-Audit-A-How-To-Guide-Checklist-WP.pdf
The AI Revolution in Customer Service - 2025
IT-ITes Industry bjjbnkmkhkhknbmhkhmjhjkhj
MENA-ECEONOMIC-CONTEXT-VC MENA-ECEONOMIC

Php5 certification mock exams

  • 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 />