homepage Welcome to WebmasterWorld Guest from 54.167.41.199
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
Forum Library, Charter, Moderators: coopster & jatar k

PHP Server Side Scripting Forum

    
Good PHP test for new-hire
blaketar




msg:4093622
 10:50 pm on Mar 8, 2010 (gmt 0)

Wondering if anyone would care to share their thoughts on some potential test questions (could be written on paper or an editor) for new PHP hire's?

One of my thoughts was to ask the potential person to write code to validate a username (not a full fledged login system) and return if the entry was available from a mockup database? This I thought would test to see if the person was more procedural or OO towards programming approaches?

Anyone have any other thoughts on QUICK test?

 

Readie




msg:4093628
 10:59 pm on Mar 8, 2010 (gmt 0)

[w3schools.com...]

Might give you a few ideas

Although it is a bit easy... I got 100% in 1 and a half mins on my first attempt :/

eelixduppy




msg:4093630
 11:06 pm on Mar 8, 2010 (gmt 0)

One way to get a quick understanding of whether or not they understand programming in general is with a quick operator test from logical operators to arithmetic operations. Some examples of this could be...

What do the following evaluate to?
  1. 6*2+7
  2. 4|1
  3. true || 1 && false


... I think you get the idea. There are an unlimited number of operator problems you can come up with, from easy to advanced. This is a good way to gauge their experience on a scale from beginning to intermediate to advanced. For example, if they have never worked with bit-level arithmetic but they get everything else correct, you get a good idea of what they've been spending their time working on. But certainly if I were you, this would be the first part of the test, because if they can't even get past this part then there is no point in even trying to do the rest.

As for the rest of the test, I would find short but thought-provoking problems that have more than one solution to them. This way you can see how they tackle the problem. Also, these questions could be specific to what their job is going to be. If they are going to be working with a lot of object-oriented stuff, it would be a great idea to add a bunch of questions about OOP in PHP.

Also, sometimes it is a good idea to give a pre-test before you even interview the person. This gives them the opportunity to see if they know what they are doing or not, because some of these guys (and girls) think they know if when they actually don't. It will save you a lot of weeding time if they don't come in the first place. This will save you tons of wasted time.

rocknbil




msg:4093653
 11:48 pm on Mar 8, 2010 (gmt 0)

IMO written or even online tests prove only that you're good at taking tests. Most of the ones I've seen were peppered with questions that were more like a programming 101 trivia quiz. Unless the job is completing tests, these won't tell you much.

Since you're here asking, it's obvious you're not sure what to ask, and most tests you'd assemble might wind up like this. :-)

You're on the right track, but make it something akin to what they will be doing. Give them 1) a simple programming task that will be a sample of what they will be doing, 2) a basic text editor, 3) a place to upload, test, debug. Set them at a computer in a quiet room. Mark the moment they go in and the moment they go out for a test of how long it took them to do it. Review the code. There's the best test of all.

StoutFiles




msg:4093661
 12:07 am on Mar 9, 2010 (gmt 0)

Give them a time limit and a computer with internet access. This isn't a classroom...in the real world if they forget the exact syntax for something they can head to their favorite coding site and look it up.

I believe the best PHP test would be to submit info in a form which accesses a database. Only specific rows should be pulled out and inserted into a table. If they can do that then surely they can learn anything else.

Readie




msg:4093672
 12:45 am on Mar 9, 2010 (gmt 0)

Perhaps a combination of several of the ideas above:

Require a quick written exam on syntax, logical operators etc. Then after you've used that to weed out some, sit the rest down at a PC with a problem to solve and time them, and review the code afterwards.

eelixduppy




msg:4093729
 2:42 am on Mar 9, 2010 (gmt 0)


IMO written or even online tests prove only that you're good at taking tests.


If the tests test your regurgitation of information then I think this is so. If the test is designed in a way that provokes thought and doesn't have a single solution, I think this is not true.


computer with internet access


This is testing their resourcefulness skills IMO. Understanding does not come from how well you can read the documentation and copy code from the internet. Give me a programming language that I've never used before, and internet access, and I will give you anything you want. Maybe that's just me, but it doesn't show that they know the material. PHP is one of the easiest languages out there. If you cannot remember the basics then the job probably isn't for you anyways. Unless you are hiring for an entry level programming position, in which case there might be a leaning curve as they work. Someone who cannot give me a function that does something relatively simple that I ask written on a piece of paper doesn't have the knowledge to work for me, IMO. You want to see the steps they take by writing the code on paper, not giving them the chance to hone their answer over and over again until its as good as possible; you aren't going to be able to weed out the good ones from the bad ones that way. Paper test is the only way IMO. If written correctly I think it will give you all the information about the person that you need.

I'll try to think of some good questions in a little bit.

StoutFiles




msg:4093734
 3:08 am on Mar 9, 2010 (gmt 0)

This is testing their resourcefulness skills IMO.


Which is the real world. Memorization is not the real world.

Give me a programming language that I've never used before, and internet access, and I will give you anything you want.


Which is why a time limit is needed.

eelixduppy




msg:4093742
 3:30 am on Mar 9, 2010 (gmt 0)

Being resourceful does not make you a good programmer. Most of the reason why the web is so insecure today is because there a bunch of "resourceful" programmers making websites without knowing what they are actually doing, taking the knowledge from a few people that do know what they are doing and applying it incorrectly. I'm not saying that having no resource skills is good, because it's quite the contrary. But you are here to test their understanding of a programming language. Tell them if they forget a function name or parameter ordering they can use pseudo-code. You're not grading syntax in these tests I'm suggesting...you are grading their understanding of the material WITHOUT resources.

rocknbil




msg:4093748
 3:46 am on Mar 9, 2010 (gmt 0)

Well put. :-)

However, I don't think it's about testing their knowledge of a programming language, it's about testing someone's ability to do the job, which will likely draw on several areas of experience. No Internet access should be allowed, but a working example is still a good idea.

I was once "tested" like this, though I didn't know I was being tested. I was in discussions with a company who knew aaaaaall about PHP but were lost in Perl. They called me in for an interview and said, "what do you think is going on here?" and sent me to a comp with a Perl app open in an editor. I had it solved in five, and they hired me, on the spot.

I declined. They just wanted to feed me all their c**p Perl jobs and slurp up the gravy themselves. LOL

jatar_k




msg:4093989
 2:13 pm on Mar 9, 2010 (gmt 0)

I have taken a few of these tests over the last year or so

I think I failed all of them, I also couldn't figure out the point of most of the questions, I ended up not wnating to work for those people.

I had one interview where it was going to be tested on use of cake, I had already told them i didn't know it but could learn quickly, they then said, they just wanted to give me a quick test to see where i was with it.

sigh, I told them it wasn't going to work out.

I don't think the tests tell you anything about programming skill.

You'd be better off figuring out their level problem solving and capacity for self teaching and eagerness to learn. Those are skills that are useful.

any monkey can code ;)

andrewsmd




msg:4093994
 2:31 pm on Mar 9, 2010 (gmt 0)

I would recommend that any test you do to be on a live system running php. No programmer is perfect without testing. As long as they can write code and debug it themselves, you know they have some skill.

eelixduppy




msg:4094004
 2:44 pm on Mar 9, 2010 (gmt 0)


You'd be better off figuring out their level problem solving and capacity for self teaching and eagerness to learn. Those are skills that are useful.


They definitely are useful. I think it's also important to know what level they are at with a specific technology, too. Most of the time these companies want results out of you as fast as possible. Especially if your resume is slacking in the experience area there really taking a risk if they hire you without knowing how well you program in the language you are being hired to write. A well-formed test should test problem solving and analytical skills as well as understanding of the technologies they would use working for the company. There needs to be some sort of base to judge on, and without these tests -- which I agree are kind of silly and may underestimate a bunch of people -- there aren't very perfect ways to test people. This is a key issue with schooling, in that our testing methods don't cater to the various types of learners; however, there simply is no efficient, better way to assess the knowledge that someone knows without testing them in a straightforward manner.

jatar_k




msg:4094039
 3:29 pm on Mar 9, 2010 (gmt 0)

I would also say that it depends on what level of programmer you are trying to hire

you can also leverage what programmers you have, maybe, to help assess new hires. It often looks like non technical people chose the php questions.

eelixduppy




msg:4094047
 3:38 pm on Mar 9, 2010 (gmt 0)

>> It often looks like non technical people chose the php questions

I resigned from a programming position once due to issues unrelated to my working there. However, before I left my boss asked me to be part of the process for those being considered as my replacement. Part of what I helped create was a test to assess the knowledge they had about what they'd be doing at the job. It included SQL queries, some basic JavaScript, CSS, HTML, and finally a PHP section. The test takers were given around 75 mins to complete the test. Almost all of the questions were phrased "Pick one of the following two". It is interesting to see which ones they choose, which says a lot also about what they know or prefer. After administering some 30 tests you really see a trend of people who know what they are talking about and those who don't. You will be so surprised at home many people cannot even code HTML correctly, let alone PHP. These people apply to these types of jobs thinking they will be much simpler than they actually are, so it's best to weed them out before you hire them, then to hire them and be sorry in the end.

jatar_k




msg:4094076
 4:15 pm on Mar 9, 2010 (gmt 0)

that sounds like a test that makes more sense

I know lots of people that can write code well, I know few real programmers

blaketar




msg:4094077
 4:18 pm on Mar 9, 2010 (gmt 0)

Here are some simple programming questions I came up with. I can write any one of these on a notepad of paper. They seem simple but if it requires use of a manual or online help the candidate may not enough basic knowledge? Let me know what you think and please feel free to add to it (would love to see something relating to OOP).

How would you write in PHP the following programming task (using SQL to interface with a mock-up database of your choice)?
•A user submits an HTML form to create a membership on a site. The form submits via POST the following form variables ($_POST[username] & $_POST[password]). These two variables need to be stored in a table named (database.users->username & database.users->password). $_POST[username] should only contain LETTERS & NUMBERS and be no longer than 30 CHARS. $_POST[password] should be mixed CHARS and before being added to database.users->password be encrypted with system MD5. (for this example, simple error checking and string function error checking has already been performed. The data your code receives is clean WITH THE EXCEPTION OF $_POST[password])

•A user wishes to LOGIN to an account already created on the site previously. The form the user uses submit via POST and contains 3 form values. $_POST[username], $_POST[password] & $_POST[submit]. Again, using SQL to interface with a mock-up database of your choice, your script needs to validate if the user has credentials to login to the system. Database.users->password column has been stored previously using MD5. Database.users->username is varchar(30). (for this example script, simple error checking has already been performed WITH THE EXCEPTION OF $_POST[password])

•A string is submitted via a form POST name $_POST[cleanit]. This data can only contain LETTERS AND NUMBERS and should all be converted to LOWER CASE along with TRIMMING. How would you achieve this via PHP?

•Step 1.) A MULTI-DIMENSIONAL ARRAY needs to be created named DATESTORAGE. The array needs to contain the following data:

-MARCH -> 3
-MAY -> 14
-OCTOBER -> 7

•Step 2.) How would you print this array to the screen showing the MONTHS along with the DAYS stored in the DATESTORAGE array?

•Prior to opening the following file USERDATE2334.txt for reading, your program should check to ensure that it exists and is readable. Return TRUE is available for reading & FALSE if the file doesn’t exist.

CyBerAliEn




msg:4094112
 5:07 pm on Mar 9, 2010 (gmt 0)

blaketar:

Those are all good examples for understanding their ability to code.

But as others suggest, I would add questions that assess their ability to formulate a program or to solve a problem. In your examples, they're told what to do --- they only need to do the code to make it happen. Most 'coders' could do this.

The difficult part of programming is often figuring out HOW to solve your problem. If you really want to see how good of a programmer they will be, you need to assess their ability to take a problem and derive a solution.

This could range from simple to complex. Present a problem and seek out their methodology for a solution (not code or syntax).

Simple... Question: How would you find out the area of a triangle? Answer: (1) Get user input of tri. base and height. (2) Do math to determine area. (3) Return or output result.

More complex... Question: A company sells products online and details of each transaction are logged in a 'product transactions' table in a SQL database. We want to generate a report showing the total revenue for the last 60 days and the average revenue per day. Answer: (1) Establish DB connection. (2) Query transactions table for last 60 days to calculate the sum and average. (3) Display result in proper format to user.

(etc) --- I would recommend just sitting down in a meeting room with the person and a white board and have them sketch their idea out on the board (or on paper). Once the framework is established, you could further challenge them. Have them detail or explain how they might specifically do the query; how they'll calculate the triangle area; etc.

Coding is easy/quick to learn once someone gets experience. You certainly want to be sure they have the ability to do basic coding (set variables; instantiate a class; create functions; understand conditions/operators; etc). But what is probably most important is being sure they have the skills to problem solve! Because this is something that is not easily learned and difficult to teach.

CyBerAliEn




msg:4094124
 5:14 pm on Mar 9, 2010 (gmt 0)

Oh...

And to test their OOP ability in PHP (code-wise or problem-solving-wise)... you could pose a problem to them and ask them to solve it via object oriented programming...

Key things you want to test:
(1) Creation of class.
(2) Creation of constructor.
(3) Creation of method(s).
(4) Instantiation of class object.
(5) Use of class object.

You could give a simple problem like: You are a vet office doing work with many clients who have many pets. Develop an introductory OOP architecture for this setting.
(a) Classes: clients; pets
(b) Do basic variables like 'name', 'phone'; 'pet name', 'pet type'; etc.
(c) Do basic methods: constructors; modify pet attributes; modify client attributes; display/list/return all client pets; etc.

You could get really indepth with this type of simple problem too. IE: 'pets' is a superclass where you have additional classes implementing it (cat, dog, bird, etc).

eelixduppy




msg:4094222
 7:20 pm on Mar 9, 2010 (gmt 0)

Some good examples. Some other examples could be similar to along the lines of rocknbil's experience where you present them with some broken code and ask them to fix it. It doesn't have to have a syntactical error, either; in fact I would recommend against it. A logical error would be more appropriate: it shows that they understand what the code is, and what needs to be done to fix it. These are really good problems, especially if you want to shorten the amount of time it takes to take this test, but still test of relevant material.

Anyango




msg:4094508
 6:53 am on Mar 10, 2010 (gmt 0)

Also, ask them to show, or talk about the work they have previously done. Looking at their code also tells alot about a programmer's logic. then you can remove some parts of that code and ask them to build them again.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / PHP Server Side Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved