Interview Questions For A Php Developer

  • Uploaded by: Daniel Cousineau
  • 0
  • 0
  • April 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Interview Questions For A Php Developer as PDF for free.

More details

  • Words: 1,092
  • Pages: 7
Interview Questions for PHP/MySQL Developer HTML and JavaScript 1. The HTML tag
does not validate when using the XHTML 1.0 Strict doctype. Why? What change is necessary for it to validate?

2. Name a tag that was deprecated in HTML 4.01 and/or XHTML 1.0 Strict.

3. Fix the following HTML snippets (assume doctype is XHTML 1.0 Strict) a.

<strong>Bold Text!



b. <span>
Sample Text


4. a. What does AJAX stand for? What is the core enabling technology behind AJAX? (hint: not language)

b. Name 2 AJAX libraries

5. a. What is JSON?

b. Turn the array {“index1” => {“one”,”two”}, “index2” => “three”} into a JSON string.

1 of 7

PHP 1. What is the major difference(s) between PHP 4.x and PHP 5.x?

2. Name a language feature being introduced in PHP 5.3

3. What is the difference between require_once(), require(), and include()?

4. What function would you use to redirect the browser to a new page? a. redir() b. header() c. location() d. redirect()

5.

What is the LITERAL output of the following script? //returns string 'true' when $bool is true, 'false' when not function tf( $bool ) { return $bool == true ? 'true' : 'false'; } $a = "5"; $b = 5; echo 'Line 1: ' . tf($a == $b) . "\n"; echo "Line 2: " . tf($a === $b) . '\n';

OUTPUT: _______________________________ _______________________________ _______________________________ 6. What is the effect of prefixing a function with an @ symbol (e.g. unlink() and @unlink())?

7. What is the security flaw in the following line of code and how would you fix it? Use the back of the page if necessary. $sql = "UPDATE products SET `name` = '" . $_GET[„name‟] . "', `price` = '" . $_GET[„price‟] . "' WHERE id = " . $_GET[„id‟] . ";";

2 of 7

MySQL 1. What are 2 database engines can you use with MySQL? What are the benefits and limitations of these engines?

2. A customer wants an e-commerce website to sell books that are published by his company. Design a database that will track relevant information about each book (author, title, back-cover snippet, ISBN, price, published date, etc.) and also track the inventory of the warehouses holding the books. Please conform to the highest normal form you feel is necessary. (Feel free to draw the design as a diagram if you wish)

3. Using your database design above, write a query that will return the first 30 books that were most recently published. Include the book’s title, author, published date, and price and only include those books which are currently in stock in one of the warehouses.

3 of 7

SAMPLE ANSWERS

4 of 7

HTML and JavaScript 6. The HTML tag
does not validate when using the XHTML 1.0 Strict doctype. Why? What change is necessary for it to validate? XHTML requires either a closing tag or explicitly self closing.
is proper.

7. Name a tag that was deprecated in HTML 4.01 and/or XHTML 1.0 Strict. , , …

8. Fix the following HTML snippets (assume doctype is XHTML 1.0 Strict) a.

<strong>Bold Text!

Closing P should be swapped with closing STRONG.

<strong>Bold Text!

b. <span>
Sample Text
SPAN tags go inside DIV tags (DIV are blocks, SPANS are inline).
<span>Sample Text
9. a. What does AJAX stand for? What is the core enabling technology behind AJAX? (hint: not language) ASYCHRONOUS JAVASCRIPT AND XML. JavaScript/XMLHTTPRequest b. Name 2 AJAX libraries jQuery, Dojo, MooTools, Scriptaculous, etc.

10. a. What is JSON? JAVASCRIPT OBJECT NOTATION, a way to serialize data in a format that can be natively parsed by javascript. b. Turn the array {“index1” => {“one”,”two”}, “index2” => “three”} into a JSON string. {“index1”: {“one”, “two”} , “index2”: “three”}

5 of 7

PHP 8. What is the major difference(s) between PHP 4.x and PHP 5.x? Object scoping, default to passing objects by reference, etc. 9. Name a language feature being introduced in PHP 5.3 Closures, __callStatic() 10. What is the difference between require_once(), require(), and include()? Require_once() throws a FATAL error if file not found, does nothing if file is already included. Require() throws a FATAL error if file not found, throws a warning if file is already included. Include() throws a WARNING if file not found, throws a warning if file is already included. 11. What function would you use to redirect the browser to a new page? a. redir() b. header() c. location() d. redirect() 12.

What is the LITERAL output of the following script? //returns string 'true' when $bool is true, 'false' when not function tf( $bool ) { return $bool == true ? 'true' : 'false'; } $a = "5"; $b = 5; echo 'Line 1: ' . tf($a == $b) . "\n"; echo "Line 2: " . tf($a === $b) . '\n';

OUTPUT: Line 1: true___________________ Line 2: false\n________________ _______________________________ (Note the single quotes around the second \n, single quoted strings will not evaluate \n, \t, etc.) 13. What is the effect of prefixing a function with an @ symbol (e.g. unlink() and @unlink())? Suppresses errors raised during the execution of said function. (In effect runs error_reporting(0) before the function call and returns error_reporting back to the way it was after the function call). 14. What is the security flaw in the following line of code and how would you fix it? Use the back of the page if necessary. $sql = "UPDATE products SET `name` = '" . $_GET[„name‟] . "', `price` = '" . $_GET[„price‟] . "' WHERE id = " . $_GET[„id‟] . ";";

SQL Injection. Encapsulate the $_GET[„…‟] with mysql_real_escape_string() or equivalent.

6 of 7

MySQL 4. What are 2 database engines can you use with MySQL? What are the benefits and limitations of these engines? MyISAM: Full Text Indexes, usually faster reads; No referential integrity (constraints) InnoDB: ACID, referential integrity; more overhead

5. A customer wants an e-commerce website to sell books that are published by his company. Design a database that will track relevant information about each book (author, title, back-cover snippet, ISBN, price, published date, etc.) and also track the inventory of the warehouses holding the books. Please conform to the highest normal form you feel is necessary. (Feel free to draw the design as a diagram if you wish)

6. Using your database design above, write a query that will return the first 30 books that were most recently published. Include the book’s title, author, published date, and price and only include those books which are currently in stock in one of the warehouses.

7 of 7

Related Documents


More Documents from ""