The "Worst Answer"

How Can Testing Be Bad?

An imaginary programming test question
This answer doesn't attempt to catch errors or release resources used, the variable names are quite terse and there is an SQL select statement rather than a call to a stored procedure.

Would the candidate write production code this way? Possibly catch the error further up the program, allow the garbage collector to eventually dispose of the database resources left in use and "I never use stored procedures as I don't see the point"

Instead of helping the recruiter, this answers starts a discussion which probably becomes an argument between the recruiter and the candidate.

Answered The Question And Nothing More

This probably shows that the person taking the test made different assumptions to the ones made by the person setting the test.
This is probably the worst answer as it works but is not production ready.

This could be proof that the candidate doesn't know how to write proper code or that the candidate thought that all that was wanted was a code fragment to prove that he has used the items under test.

The tester is left with almost as many questions as when he started, what would the candidate's code be like when working for real?


Answer C#

    protected void LoadDataAnswer2(String dbase, DataTable result)
    {
        SqlConnection conn = new SqlConnection(dbase);
        SqlCommand cmd = new SqlCommand();
        conn.Open();cmd.Connection = conn; cmd.CommandType = CommandType.Text;
        cmd.CommandText = @"SELECT Company,CompanyTicker,Keypoints,SharePriceCat,MinPrice,
                          MaxPrice,LastReviewPrice,LastReviewDate,ShareIndex
                     FROM StockTickers WHERE ShareIndex = 'FTSE 100'";
        SqlDataReader dr = cmd.ExecuteReader(); result = new DataTable(); result.Load(dr);
    }

Answer SQL

Candidates point of view - It's only a test so I have embedded the SQL into the C#, in the real world I would use a stored proc or possibly a view or whatever the company policy is. But that's not the point of this test.


Other Interesting Pages On Some Of My Sites.
Weight Loss Calculator
Screen shot of weight loss calculator Weight Loss Calculator Tries to simulate the body and report the effects of food and exercise in periods as short as 15 minutes.

This level of detail highlights the effects of a run, bike ride or chocolate bar.

For those who are new to exercise, weight fluctuation due to glycogen usage is made much clearer.
Initial Programming Language
IPL Screen shot Initial Programming Language possibly the easiest way to learn programming on a Windows computer.

Designed to mimic the simplicity of the 1980s home computers where you could get started in minutes...

...but still powerful enough to do pretty complex things.
Learn To Budget
Money Manager Screen shot Learn To Budget MoneyManger.ipl is a free, MS Windows based, computer program that can be used with children and young adults to practice budgeting

Put simply you get paid once a week, you then spend this money on food, rent etc. If you do just this, then you will be able to save some money and then buy cars, holidays etc.
Please note that these links do not use any tracking cookies or similar technology.