0% found this document useful (0 votes)
90 views

PHP Developer Questions

This document contains screening questions for a web developer position, including questions on HTML, CSS, JavaScript, PHP, database schema design, MySQL queries, and a general question about favorite websites. The questions cover topics like table coding in HTML, absolute vs relative positioning in CSS, changing an image source with JavaScript, looping through POST parameters in PHP, designing an employee database with multiple reporting levels, joining customer and order tables, and reasons for liking layout, content and coding of CNN.com.

Uploaded by

Sridhar Karthik
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
90 views

PHP Developer Questions

This document contains screening questions for a web developer position, including questions on HTML, CSS, JavaScript, PHP, database schema design, MySQL queries, and a general question about favorite websites. The questions cover topics like table coding in HTML, absolute vs relative positioning in CSS, changing an image source with JavaScript, looping through POST parameters in PHP, designing an employee database with multiple reporting levels, joining customer and order tables, and reasons for liking layout, content and coding of CNN.com.

Uploaded by

Sridhar Karthik
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Web Developer Screening Questions

Name:

1. HTML
Please code the following table in HTML:

Ans:
<html>
<body>
<table border="1">
<tr>
<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
<td rowspan="1"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>&nbsp;&nbsp;&nbsp;<br></td>
<td valign="top"><b>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</b></td></tr>
</table>
</body>
</html>

2. CSS:
What are the differences between absolute and relative positioning?
How do you remove the underline of a link with CSS?

Ans:Using position:relative, we can use top or bottom, and left or right to move the element relative to where it would
normally occur in the document.
When position:absolute, the element is removed from the document and placed exactly where we tell it to go.
To remove underline of a link using css:
<STYLE>
a {text-decoration:none}
</STYLE>

3. JavaScript:
When a user clicks on the following image, it changes from pic_1.gif to pic_2.gif. Please define the function
changePic().

<img src=”pic_1.gif” name=”my_pic” onClick=”changePic()”>

Ans:

<script language="Javascript">
myImage=new Array(2)
for (var i=0;i<2;i++){
myImage[i]=new Image();
myImage[i].src="pic_"+(i+1)+".gif"
}
currentImage=0;
function changePic(){
switch(currentImage){
case 0: document.my_pic.src=myImage[1].src;
currentImage=1;
break;
case 1: document.my_pic.src=myImage[0].src;
currentImage=0;
break;
}
}
</script>
<img src=”pic_1.gif” name=”my_pic” onClick=”changePic()”>
4. PHP:
How do you loop through the parameters of a POST request and display the values in PHP?

Ans:
foreach($_POST as $name => $value) {
print "$name : $value<br>";

5. Database:
Please design a database schema of an employee table in which each employee (except the CEO) has a
supervisor. Allow for an arbitrary number of levels to the structure.

Ans:

CREATE TABLE `position` (


`id` int(11) NOT NULL auto_increment,
  `level` varchar(10) NOT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `level` (`level`)
) AUTO_INCREMENT=5;
INSERT INTO `position` (`id`, `level`) VALUES
(1, 'CEO'),
(2, 'Director),
(3, 'Team Lead'),
(4, 'programmer');
CREATE TABLE `staff` (
  `id` int(11) NOT NULL auto_increment,
  `staff_name` varchar(30) NOT NULL,
  `title` int(11) NOT NULL,
  `supervisor` int(11) NOT NULL,
  PRIMARY KEY  (`id`)
) AUTO_INCREMENT=5;
INSERT INTO `staff` (`id`, `staff_name`, `title`, `supervisor`) VALUES
(1, 'Mr. CEO', 1, 1),
(2, 'Mr. Director', 2, 1),
(3, 'Mr. Team Lead', 3, 2),
(4, 'Mr. Programmer', 4, 3);

6. MySQL:
Assume you have a Customer table and an Order table where each order has a
CustomerID:

Customer
Field Index
CustomerID (int) PrimaryKey
Name (varchar)

Order
Field Index
OrderID (int) PrimaryKey
CustomerID (int)
OrderItem (varchar)

How can you query these tables to produce a list of all customers and their orders?
How can you query them to get a list of only those customers who have orders?

Ans:
SELECT * from Customer LEFT JOIN Order ON Customer.CustomerID = Order.Customer.ID;
SELECT * from Customer, Order WHERE (Customer.CustomerID = Order.Customer.ID);
7. General:
What is your favorite website? Why (layout, content, and coding)?
Ans: My favorite website is CNN.com. I find this website a very good example for good design and usability.
Apart from being a resource on many news and topics it makes it possible for users to easily go to his choice of news and
access any kind of media related to a news. Being able to serve so many users without any breakdown is only possible
after a lot of engineering from developers .Also keeping it updated daily and allowing ads without too much distraction for
users makes it a perfect choice to visit daily for news and interesting topics.

You might also like