RE: [PHP] Basic PHP knowledge test
Here's one companies quiz that they gave: With each question, please keep the code short and simple. Make notes on possible caveats and fixes rather than adding a lot of error-checking to your code. 1. Write a PHP script to remove duplicate lines from a file. Do not worry about efficiency. Ex. input: Tree Donut Fish Food Tree Tree Doctor Fish Food Ex. output: Tree Donut Fish Food Doctor 2. Write a PHP script that retrieves the Word of the Day from http://dictionary.com/. 3. Write a PHP web page script which redirects visitors to google.com if their IP address is not of the form 10.x.x.x nor 192.168.x.x. Users who do not get redirected should be shown a top secret message. 4. Write a PHP script which inserts the contents of a TAB-delimited text file into a MySQL table. You must create the table. The columns are named in the file. Here is the data format with some example data: idnameageemailactive 1Bertha93[EMAIL PROTECTED]1 2Sammy40[EMAIL PROTECTED]1 3Erin15[EMAIL PROTECTED]0 4Rupert29[EMAIL PROTECTED]1 5. Write a PHP function to determine if two strings are close enough, such as to find misspelt words. o Extra letters are OK. close_enough( 'apartment', 'appartmeant' ); returns true o Missing letters are OK. close_enough( 'apartment', 'aprmnt' ); returns true o Substitutions are OK. close_enough( 'apartment', 'apardmint' ); returns true o Only allow up to 1 error per 3 letters in the correct word, rounding up. For example, a 10-letter word can have up to 4 errors. They can be anywhere in the word. -Original Message- From: John Nichel [mailto:[EMAIL PROTECTED] Sent: Thursday, July 20, 2006 5:31 AM To: PHP Mailing Lists Subject: Re: [PHP] Basic PHP knowledge test Finner, Doug wrote: >>> My advice, give the candidates problems and see how they solve them. > Even if they don't finish, you get an idea of how they think. >>> tedd > > I like this idea! > > Do you expect them to be able to work with code written by others? If > so, hand them some of your existing code (good examples and not so good) > and ask them to figure out what it does and recommend changes. > Most definitely. This position isn't going to really require the person to write their own apps. Most of the stuff he/she will be doing is maintaining code already in place. Plenty of it will be my code, but prior to me starting here three years ago, they used to just get people on a contract basis, and there's some pretty messed up code. They even contracted a job out to a couple of Russian programmers; code's pretty clean, but all the comments are in Russian. ;) I like the idea of giving them a piece of our existing code and getting them to do something with it...I'll just have to get HR to accept my word on how they did on it (they really want a question and answer sheet that they can 'grade'). > I really really like the 'give them a problem and have them solve it' > idea... > Yeah, one of my earliest thoughts on this was to have them write something simple like connecting to a db, selecting multiple rows, parsing our the result, and displaying it in some fashion. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
On Thu, 2006-07-20 at 09:19, Jochem Maas wrote: > Ray Hauge wrote: > > On Thursday 20 July 2006 07:23, John Nichel wrote: > >> Yeah, one of my earliest thoughts on this was to have them write > >> something simple like connecting to a db, selecting multiple rows, > >> parsing our the result, and displaying it in some fashion. > > > > Don't forget making it secure. Here is one of my questions people can use > > if > > they like. Feel free to re-word it. I'm a programmer, not a writer ;) > > > > What change(s) would you make to the following code to make it more secure? > > > > $id = $_GET['id']; > > mysql_query(“DELETE FROM myTbl WHERE id = $id”); > > /* > // removed security flaw > $id = $_GET['id']; > mysql_query(“DELETE FROM myTbl WHERE id = $id”); > //*/ > > ;-) You removed a lot more than the security flaw. No job for U! Cheers, Rob. -- .. | InterJinn Application Framework - http://www.interjinn.com | :: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `' -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Ray Hauge wrote: > > Don't forget making it secure. Here is one of my questions people can use if > they like. Feel free to re-word it. I'm a programmer, not a writer ;) > > What change(s) would you make to the following code to make it more secure? > > $id = $_GET['id']; > mysql_query(“DELETE FROM myTbl WHERE id = $id”); Believe it or not, I've lost count of how many times I've seen things like this in Real Life. SQL Injection waiting to happen... > I like this question, because they have to know at least the fundamentals of > PHP security. Agreed. One thing I would add is to make sure they're familiar with the PHP version you use. Regards, Austin. signature.asc Description: OpenPGP digital signature
Re: [PHP] Basic PHP knowledge test
Ray Hauge wrote: > On Thursday 20 July 2006 07:23, John Nichel wrote: >> Yeah, one of my earliest thoughts on this was to have them write >> something simple like connecting to a db, selecting multiple rows, >> parsing our the result, and displaying it in some fashion. > > Don't forget making it secure. Here is one of my questions people can use if > they like. Feel free to re-word it. I'm a programmer, not a writer ;) > > What change(s) would you make to the following code to make it more secure? > > $id = $_GET['id']; > mysql_query(“DELETE FROM myTbl WHERE id = $id”); /* // removed security flaw $id = $_GET['id']; mysql_query(“DELETE FROM myTbl WHERE id = $id”); //*/ ;-) > > I like this question, because they have to know at least the fundamentals of > PHP security. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
On Thursday 20 July 2006 07:23, John Nichel wrote: > Yeah, one of my earliest thoughts on this was to have them write > something simple like connecting to a db, selecting multiple rows, > parsing our the result, and displaying it in some fashion. Don't forget making it secure. Here is one of my questions people can use if they like. Feel free to re-word it. I'm a programmer, not a writer ;) What change(s) would you make to the following code to make it more secure? $id = $_GET['id']; mysql_query(“DELETE FROM myTbl WHERE id = $id”); I like this question, because they have to know at least the fundamentals of PHP security. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
John Nichel wrote: What does $_POST['x'] mean? What does $ in front of a string of chars without quotes mean? That does register globals mean? Is it possible to run php as a cgi script? When it is necessary to use 'var' in php code? I would probably agree that a problem would be better. Here's an idea, have one of your HR people take some existing code and do something to it to give it a bug, then have the guy fix it, and see how close he comes to what's there. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Finner, Doug wrote: My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. Most definitely. This position isn't going to really require the person to write their own apps. Most of the stuff he/she will be doing is maintaining code already in place. Plenty of it will be my code, but prior to me starting here three years ago, they used to just get people on a contract basis, and there's some pretty messed up code. They even contracted a job out to a couple of Russian programmers; code's pretty clean, but all the comments are in Russian. ;) I like the idea of giving them a piece of our existing code and getting them to do something with it...I'll just have to get HR to accept my word on how they did on it (they really want a question and answer sheet that they can 'grade'). I really really like the 'give them a problem and have them solve it' idea... Yeah, one of my earliest thoughts on this was to have them write something simple like connecting to a db, selecting multiple rows, parsing our the result, and displaying it in some fashion. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Please reply to the list. jekillen wrote: On Jul 19, 2006, at 8:31 AM, John Nichel wrote: We're looking to hire an entry level php programmer here, and I've been tasked with writing the test to evaluate the potential candidates. Being the lazy guy that I am, I naturally turned to Google to see if I could find some tests that I could use. After clicking thru many links, and finding mostly 'basic php tutorials', I've come here to ask you people to do my homework for me. ;) Does anyone have any links/resources for a basic php knowledge test? If not, I'll have to write one from scratch myself, and mess up the rest of my day of goofing off/sleeping. What does $_POST['x'] mean? What does $ in front of a string of chars without quotes mean? That does register globals mean? Is it possible to run php as a cgi script? When it is necessary to use 'var' in php code? If you can't answer these questions how are you going to know if someone is giving you the right answers? There are tons of basic to advance books on the commercial market about php. I've gone the distance and shelled out literally 1,000 of dollars buying books and hours learning the stuff. If you want answers to your questions spend a little time so you will know if someone has passed a test or not. I've spent the past 8+ years 'going the distance' in PHP (quite a bit longer when you count in things like Perl, PASCAL, COBOL, etc), and shelled out about $25 on one PHP book. The web is a far better, cheaper, and more up-to-date learning source. However, I'm a geek, not some college kid who writes up documents so that HR can have a pretty piece of paper saying this guy knows the difference between '==' and '==='. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
To refine that a bit, you may want to give them some code that has been intentionally broken (simple things for the entry level position, such as missing semicolons or curly braces etc) and watch to see how they go about discovering the parse errors. To me, it would be better to hire someone that can solve problems quickly, not someone who can simply tell you what a piece of code is doing. Just a thought though - good luck! -Joe On Jul 20, 2006, at 7:20 AM, Finner, Doug wrote: My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. I really really like the 'give them a problem and have them solve it' idea... Doug __ _ This e-mail message has been sent by Kollsman, Inc. and is for the use of the intended recipients only. The message may contain privileged or confidential information. If you are not the intended recipient you are hereby notified that any use, distribution or copying of this communication is strictly prohibited, and you are requested to delete the e-mail and any attachments and notify the sender immediately. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic PHP knowledge test
>>My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. >>tedd I like this idea! Do you expect them to be able to work with code written by others? If so, hand them some of your existing code (good examples and not so good) and ask them to figure out what it does and recommend changes. I really really like the 'give them a problem and have them solve it' idea... Doug ___ This e-mail message has been sent by Kollsman, Inc. and is for the use of the intended recipients only. The message may contain privileged or confidential information. If you are not the intended recipient you are hereby notified that any use, distribution or copying of this communication is strictly prohibited, and you are requested to delete the e-mail and any attachments and notify the sender immediately. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
At 11:31 AM -0400 7/19/06, John Nichel wrote: >We're looking to hire an entry level php programmer here, and I've been tasked >with writing the test to evaluate the potential candidates. Being the lazy guy >that I am, I naturally turned to Google to see if I could find some tests that >I could use. After clicking thru many links, and finding mostly 'basic php >tutorials', I've come here to ask you people to do my homework for me. ;) >Does anyone have any links/resources for a basic php knowledge test? If not, >I'll have to write one from scratch myself, and mess up the rest of my day of >goofing off/sleeping. Why is hr typically so limited in creativity? Do you want someone who can read and regurgitate the manual or do you want someone who can get the job done? My advice, give the candidates problems and see how they solve them. Even if they don't finish, you get an idea of how they think. tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
At 12:12 PM -0400 7/19/06, John Nichel wrote: >The worst part of it is, I'm going to have to be involved in the interview >process, and I'm *not* a people person. ;) Really, who would have guessed that? ;) tedd -- http://sperling.com http://ancientstones.com http://earthstones.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
On 7/19/06, KermodeBear <[EMAIL PROTECTED]> wrote: > Does anyone have any links/resources for a > basic php knowledge test? If not, I'll have to > write one from scratch myself, and mess up the > rest of my day of goofing off/sleeping. It wouldn't hurt to pick up one of those Zend PHP Certification study guides and pull some things from there. Or, browse the PHP manual for commonly used functions and ask questions from there. Assuming that doing so was either "Fair use" or authorised by Zend, and that you aren't going to get your ass sued for copyright violation - then again maybe on a small enough scale. What might work better though would be to pull some questions from this mailing list and ask them how they would answer them. It will give you some insight into their knowledge of PHP as well as how well they can solve problems using the language. To an extent. I personally think the best way is to outline a set of situations and have them write scripts to solve that problem. You need to know that they have both the knowledge and language to solve a problem. It doesn't really matter if they know the syntax of strpos, if they know other methods of solving their potential problems. Perhaps a CSV to MySQL converter - although not exactly that, because I've mentioned it on the list :p That, in my (not so) humble opinion, is better than just knowledge of the language. You need to know how to apply it to be a decent programmer. HTH. I would be very interested in seeing what you come up with, actually. (o: After the person sitting the exam has passed their test. -K. Bear -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
On Wednesday 19 July 2006 11:12, John Nichel wrote: > Yeah, reading the writing on the wall, I think I'm just going to have to > suck it up, and write it. The worst part of it is, I'm going to have to > be involved in the interview process, and I'm *not* a people person. ;) > > I think I'll go with a few syntax questions (not really worried about > that aspect, cause even after 8 years of doing php, I still hit the > manual a few times a week), maybe have the people write a basic function > or two to check how clean/readable their code it. Possibly also test > how efficient their code would be (like to they call a function inside > of a loop to get a static value that could have been set outside the > loop). Basic db stuff...ugh, I don't feel like doing this. > > I'll post what I come up with here; maybe we (this list) can combine > ideas and such, and actually put together a pretty good test or two so > we can spare the next poor soul who gets put into this position by MBA > wielding managers. That's pretty much what I did. I went with questions that would show how much they understand from a conceptual level. I don't know many people who don't have www.php.net as a bookmark. I did basic questions to show they understood OOP, recursion, pass-by-reference, etc. I also had to be in the interview. There were a lot of odd moments of silence when people were looking at me to ask some questions. I just wanted him to do the quiz and that was pretty much it ;) -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Ray Hauge wrote: On Wednesday 19 July 2006 10:31, John Nichel wrote: We're looking to hire an entry level php programmer here, and I've been tasked with writing the test to evaluate the potential candidates. Being the lazy guy that I am, I naturally turned to Google to see if I could find some tests that I could use. After clicking thru many links, and finding mostly 'basic php tutorials', I've come here to ask you people to do my homework for me. ;) Does anyone have any links/resources for a basic php knowledge test? If not, I'll have to write one from scratch myself, and mess up the rest of my day of goofing off/sleeping. I just recently ran into the same problem. I got tired of trying to find one, so I made it myself. It's very specific to what we do here though. I'd definitely be interested in that info though, because we're still looking, and I'm not totally happy with mine, as I didn't have a whole lot of time to write it. Yeah, reading the writing on the wall, I think I'm just going to have to suck it up, and write it. The worst part of it is, I'm going to have to be involved in the interview process, and I'm *not* a people person. ;) I think I'll go with a few syntax questions (not really worried about that aspect, cause even after 8 years of doing php, I still hit the manual a few times a week), maybe have the people write a basic function or two to check how clean/readable their code it. Possibly also test how efficient their code would be (like to they call a function inside of a loop to get a static value that could have been set outside the loop). Basic db stuff...ugh, I don't feel like doing this. I'll post what I come up with here; maybe we (this list) can combine ideas and such, and actually put together a pretty good test or two so we can spare the next poor soul who gets put into this position by MBA wielding managers. -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
Jim Moseby wrote: STFW! RTFM!! STFA!! STFU!! That totally goes against my being lazy. Hell, I didn't get to where I am today by *not* exploiting the 'little people' :-p -- John C. Nichel IV Programmer/System Admin (ÜberGeek) Dot Com Holdings of Buffalo 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic PHP knowledge test
> Does anyone have any links/resources for a > basic php knowledge test? If not, I'll have to > write one from scratch myself, and mess up the > rest of my day of goofing off/sleeping. It wouldn't hurt to pick up one of those Zend PHP Certification study guides and pull some things from there. Or, browse the PHP manual for commonly used functions and ask questions from there. What might work better though would be to pull some questions from this mailing list and ask them how they would answer them. It will give you some insight into their knowledge of PHP as well as how well they can solve problems using the language. That, in my (not so) humble opinion, is better than just knowledge of the language. You need to know how to apply it to be a decent programmer. HTH. I would be very interested in seeing what you come up with, actually. (o: -K. Bear -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Basic PHP knowledge test
> > We're looking to hire an entry level php programmer here, and > I've been > tasked with writing the test to evaluate the potential candidates. > Being the lazy guy that I am, I naturally turned to Google to > see if I > could find some tests that I could use. After clicking thru > many links, > and finding mostly 'basic php tutorials', I've come here to ask you > people to do my homework for me. ;) Does anyone have any > links/resources for a basic php knowledge test? If not, I'll have to > write one from scratch myself, and mess up the rest of my day > of goofing > off/sleeping. STFW! RTFM!! STFA!! STFU!! Ahem... Now that that's out of my system, you could start with the Zend sample exam: http://www.zend.com/education/certification/self_test I know you're saying "entry level", not "Zend certified", but there are some pretty basic questions there. JM -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Basic PHP knowledge test
On Wednesday 19 July 2006 10:31, John Nichel wrote: > We're looking to hire an entry level php programmer here, and I've been > tasked with writing the test to evaluate the potential candidates. > Being the lazy guy that I am, I naturally turned to Google to see if I > could find some tests that I could use. After clicking thru many links, > and finding mostly 'basic php tutorials', I've come here to ask you > people to do my homework for me. ;) Does anyone have any > links/resources for a basic php knowledge test? If not, I'll have to > write one from scratch myself, and mess up the rest of my day of goofing > off/sleeping. > > -- > John C. Nichel IV > Programmer/System Admin (ÜberGeek) > Dot Com Holdings of Buffalo > 716.856.9675 > [EMAIL PROTECTED] I just recently ran into the same problem. I got tired of trying to find one, so I made it myself. It's very specific to what we do here though. I'd definitely be interested in that info though, because we're still looking, and I'm not totally happy with mine, as I didn't have a whole lot of time to write it. -- Ray Hauge Programmer/Systems Administrator American Student Loan Services www.americanstudentloan.com 1.800.575.1099 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php