PHP Developer Interview Ability Benchmark



  • So I've been tasked with creating a paper test to hand applicants for the small web firm I work for. All developers are expected to know PHP and MySQL, and this test is designed to test that.

    Feedback would be appreciated.

    • Is PHP compiled or interpreted, and why?

    • In Objects, what is visibility and how does it change the output?

    • Simplify the following code:
      $a = 15 / $num_pieces;
      $a_piece = floor($a);
      $rem = 15 – ($a_piece * $num_pieces);

    • What is the ternary operator and how is it used?

    • Name one built-in function in PHP 5 which you can use to implement regular expressions.

    • What is a relational database?

    • Consider the code below:
      $var = “Something”;
      $Var = “Nothing”;
      $1var = TRUE;
      $_2Var = array(“1”, “2”);
      $NoVar = &$Var;
      $$Var = “A Lot Of Nothing”;
      $NoVar = “A Lot Of Something”;

      (a) What, if any, variable declarations do not succeed?

      (b) Of the variables that succeed, what are their values at the end of this block of code (as you would reference them)?



    • What is a Super Global variable, and what is an example of one?

    • What is the difference between a reference and an instance?

    • Name three types of loops.

    • Consider the following statement:
      SELECT * FROM tbl_generic LIMIT 0,1
      (a) Add a clause to this statement returning records with an “id” larger than 10.
      (b) Add a clause to the statement from (a) sorting the records by “rating”, from highest to lowest.
      (c) Change the LIMIT clause in the statement from (b) to select 50 records starting with record 15.
      (d) Change the SELECT clause in the statement from (c) to only select the “name” and “price” from tbl_generic.



    • What does “PDO” stand for in PHP 5?

    • What statement deletes all data in a MySQL table without deleting the table or table structure?

    • What is the difference between a session and a cookie?

    • For what values of $var does the following statement fail, for what values does it not execute, and for values does it display:
      if ($var) {echo “Hello”;}


  •  Your PHP-questions are of a too high level compared to your basic MySQL-questions. (Both are pretty low by the way).

    I would ask for them to write some more code instead of one simplify-questions.



  •  It is really hard to help you with this without knowing what level the position is.  Is this an entry level position or senior software engineer?



  • This is more of an entry level position, however being that this is a small business their skill level should fall somewhere inbetween the two. We need to bring more people in for a new project we have, people we plan on keeping, but as the lone PHP developer currently, I can't afford to spend my time babysitting them.

    colour:

    Any suggestions on how to improve it? I'm trying to design this test to be failed, so a wide range of questions that they can and cannot answer are what I'm looking for.

    By more code, do you mean a situational problem, or do you mean "consider..."



  • Nothing about OO?



  • Moved to Help, where it's more at home. :)



  • @JordanL said:

    I'm trying to design this test to be failed, so a wide range of questions that they can and cannot answer are what I'm looking for.

    Are you trying to weed out applicants who are no good, or are you trying to obtain a statistical cross-section of the knowledge of the group of applicants that come by your desk?

    What I mean is; some of these questions are more academic than practical. For example, how would differentiating between compiled and interpreted affect an applicant's chances of being hired? I know it's interpreted, but I don't think you want me writing your PHP5 apps because my PHP knowledge is sparse at best. ;)



  • @dhromed said:

    I know it's interpreted, but I don't think you want me writing your PHP5 apps because my PHP knowledge is sparse at best.

    It's really compiled that runs on top of a VM. 



  •  Honestly, this kind of test will tell you very little. I would concentrate on domain specific questions. If you're doing web applications then ask more "session vs cookie" type questions. Minor details about which variable assignment will fail are pointless. Also, as someone else mentioned ask some OO questions. Broader conceptual questions will distinguish a good programmer.



  • @chebrock said:

    If you're doing web applications then ask more "session vs cookie" type questions.

    Are you serious?  That's like asking a mechanic what the difference between a car and a horse is.  Even a moron could probably get it right. 



  • Yes, Im serious. Did I say that's the only question he should ask? Any moron can learn low level tasks like variable assignments. I doubt you could effectively illustrate WHEN you might consider cookies vs sessions, the nature of session management, sessions that may or may not use cookies, user id's and so on. It's a complicated topic.



  • @JordanL said:

    >In Objects, what is visibility and how does it change the output?

    This question is confusing. For one thing "Objects" is a common noun that should not be capitalized. Maybe you should "object-oriented programming languages". Plus "visibility" isn't a term that everybody uses. Finally, "how does it change the output" depends on what program we're talking about, how it's already implemented, and how you would change it.

    @JordanL said:

    Simplify the following code:

    $a = 15 / $num_pieces;

    $a_piece = floor($a);

    $rem = 15 – ($a_piece * $num_pieces);

    I see what you're asking, but the truth is that it's already in a simplified form. Perhaps a better question would be, "how could you rewrite these 3 lines into 1 line, and which form is better? why?" The first form (if you use good variables names) has the advantage of giving meaning to the subexpressions that are being evaluated in the last line.

    @JordanL said:

    Name one built-in function in PHP 5 which you can use to implement regular expressions.

    Again, the wording is very tricky here. Developers are very literal, and what you're asking them is to name a function which [i]implements[/i] regular expressions, when I think you mean a function which [i]uses[/i] regular expressions. If you want to implement an entire regex engine, it's going to take far more than a single library call.

    @JordanL said:

    What is a relational database?

    That's a vague question for a written test, but possibly a good conversation starter for an oral interview.

    @JordanL said:

    Consider the following statement:

    SELECT * FROM tbl_generic LIMIT 0,1

    (a) Add a clause to this statement returning records with an “id” larger than 10.

    (b) Add a clause to the statement from (a) sorting the records by “rating”, from highest to lowest.

    (c) Change the LIMIT clause in the statement from (b) to select 50 records starting with record 15.

    (d) Change the SELECT clause in the statement from (c) to only select the “name” and “price” from tbl_generic.

    This question is actually what prompted me to reply. In A, if you add "where id > 10", you'll still only get one row, even though the question uses the plural form "rows", implying that you should get all of them. This would be confusing to a good developer filling out a written test -- like I said, developers are generally very literal when it comes to programming (and usually that's a good thing). If this was an oral test, then he could ask questions to clarify, and the questions themselves would reflect well on the candidate; but on a written test he has no recourse but to either be a smart ass or else dumb down his answers.

    @JordanL said:

    What statement deletes all data in a MySQL table without deleting the table or table structure?

    This could be "TRUNCATE" or "DELETE". A better question would be, "Which two SQL statements delete data from a table, and what's the difference between the two?"

    Also I fail to see the distinction between "table" and "table structure".

    If I were you, I'd be looking for somebody who understands core concepts of software construction, like those discussed in Code Complete. Also if you want to test for core competency, test them on version control, collaboration, and debugging too.



  • Ignore morbiuswilters, he's simply trolling you.

     




  • @Jeff S said:

    Ignore morbiuswilters, he's simply trolling you.

    Trolling him?  I'm calling him a moron for stating that sessions and cookies are a complicated topic.  This is the same guy who is stunned a web app could possibly take more than 6 months to write.  Obviously he has no relevent experience and should not be dispensing advice.  I'm trying to steer the OP away from bad advice that is going to result in low-quality hires who will further degrade the state of our art. 



  • @MasterPlanSoftware said:

    Jeff S has determined that anyone on the IRC channel is a troll
    Is this something he's told you or are you just making shit up? If you believe it, then maybe you should invite Jeff to the IRC channel to talk to him and discuss your respective expectations.

    That said, I have been noticing MPS's posts getting deleted here and there, so there might be some meat to your theory. The ones I remember seeing (which now no longer exist) seemed to be mostly benign; just the usual MPS stuff.



  • @morbiuswilters said:

    Trolling him?  I'm calling him a moron for stating that sessions and cookies are a complicated topic.  This is the same guy who is stunned a web app could possibly take more than 6 months to write.  Obviously he has no relevent experience and should not be dispensing advice.  I'm trying to steer the OP away from bad advice that is going to result in low-quality hires who will further degrade the state of our art. 
     

    Unlike most people on this board, I'm capable of having a disagreement and not feeling the need to reduce it to trolling. It may come as a surprise but BEHOLD: two people arguing and nobody cries, censors, or calls the other a troll.

    Back to the topic at hand. It is you MorbiusWilters who is the moron. I state, for the record, that session management is a non trivial issue, and it is you that have no experience with complicated applications, and I would guess that your experience with sessions are along the lines of "Welcome Back Harold this is the 3rd time you've visted the site"

    I should add, categorically, that development time, line # of lines of code, is totally irreleventant to complexity of said application. persons stating an application takes a year to develop are probably mediocre programmers with none of the ability and skill to develop said application in 1/4 of the time - better, faster, leaner, and more secure. dont embarass yourself. I also state anyone taking a year on a web application is not a real developer - it is absurd. A YEAR? Insanity.



  • @Welbog said:

    Is this something he's told you or are you just making shit up?
     

    He has been deleting most posts from bstorer, myself, and morb between yesterday and today.

    And yes, he admits to it.

     

    More to come...



  • @chebrock said:

    I also state anyone taking a year on a web application is not a real developer - it is absurd. A YEAR? Insanity.

    Sooooo--; how long has Gmail been in beta again?



  • @Welbog said:

    Is this something he's told you or are you just making shit up? If you
    believe it, then maybe you should invite Jeff to the IRC channel to
    talk to him and discuss your respective expectations.
     

    Sadly, I PM'ed him and also tried to discuss this with him in the IRC channel, but was ignored via PM and told to "eat shit and die" in the IRC channel.

    My expectations for him are simple:  no childish insults.  That's ... pretty much it.  It's possible to be funny, clever and intelligent in different ways, but unfortunately none of them involve calling people "retards".

     

     



  • @Jeff S said:

     

    Sadly, I PM'ed him and also tried to discuss this with him in the IRC channel, but was ignored via PM and told to "eat shit and die" in the IRC channel.

    My expectations for him are simple:  no childish insults.  That's ... pretty much it.  It's possible to be funny, clever and intelligent in different ways, but unfortunately none of them involve calling people "retards".

     

    If only the facts supported any of this crap you are spewing.



  • @Ragnax said:

    @chebrock said:
    I also state anyone taking a year on a web application is not a real developer - it is absurd. A YEAR? Insanity.

    Sooooo--; how long has Gmail been in beta again?

     

    Forget gmail.  Google search is a web application.  On the surface it has a very simple interface.  However, the number of man years that has gone in to it's development is much greater than 1.  

    chebrock,  stop saying that people are bad developers because they take a long time to do things.  You make yourself look incredibly naive. 


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.