RE: Basic PHP knowledge test

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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:
id<TAB>name<TAB>age<TAB>email<TAB>active
1<TAB>Bertha<TAB>93<TAB>ber@xxxxxxxxxxxxxx<TAB>1
2<TAB>Sammy<TAB>40<TAB>sam010@xxxxxxx<TAB>1
3<TAB>Erin<TAB>15<TAB>erin@xxxxxxxx<TAB>0
4<TAB>Rupert<TAB>29<TAB>rup@xxxxxxx<TAB>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:john@xxxxxxxxxxxx] 
Sent: Thursday, July 20, 2006 5:31 AM
To: PHP Mailing Lists
Subject: Re:  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
jnichel@xxxxxxxxxxxxxxxxxxxxxxxxxxx

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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux