I find this somewhat intelectually less demanding than the if/else
print both question.
I would regard your routine task as a mandatory complement to that
"stupid" question :-).


Vasek



On Tue, Oct 21, 2008 at 12:31 PM, Paul Herring <[EMAIL PROTECTED]> wrote:
> On Tue, Oct 21, 2008 at 10:32 AM, Vaclav Stumbauer <[EMAIL PROTECTED]>
> wrote:
>> My subjective view is that they're stupid only in the space of real
>> world scenarios but not in the space of problem solving capability tests
>> :-)
>
> If they're not realistic, then what exactly are they supposed to be
> testing? Why are they the best method of testing how you'll actually
> perform on the job, rather than, say, stuff based on real life?
>
> If you want to test problem solving, give a real problem to solve. Not
> trick questions.
>
>> They are short enough and have small solution space enough to be usefull
>> in such tests.
>
> They aren't useful though. That's the point. They are questions with
> rote answers. All you're testing is the candidates ability to learn
> rote answers. You might as well set a test with questions like "What's
> 6 times 12" if that's what you want to test.
>
>> No offence - what some useful and utile test chunks with similar
>> properties based on real world scenarios would be?
>
> Real, live example, which I had to do.
>
> Assume 'int translate_float(const char* value, double* result)'
> returns 0 on failure and converts a 'value' string into a double in
> result on success:
>
> int translate_latitude(const char* direction, const char* value,
> double* result){
> /* Translates DDmm.mmmm{N|S} into {-}DD.DDDDDD.. */
> double mixed, minutes;
> int int_degrees;
>
> if (!direction || !direction[0] || !value || !value[0] || !result){
> /* either NULL pointers or NUL strings */
> *result = 0.0;
> return 0; /* Fail */
> }
>
> if (!translate_float(value, &mixed)){
> /* no conversion made */
> *result = 0.0;
> return 0; /* Fail */
> }
>
> int_degrees = (int)(mixed/100);
> minutes = (mixed - int_degrees*100)/60.0;
>
> *result = int_degrees + minutes;
>
> if ('S' == direction[0] || 's' == direction[0]){ /* toupper() was
> generating a warning which I couldn't remove */
> (*result) *= -1;
> }
>
> return 1; /* success */
> }
>
> What tests/input would you put into this piece of code to test all
> paths of execution?
>
>> I'm asking just since my poor mind can't think of any such a solution
>> right now, not to boost the quarrel.
>
> --
> PJH
>
> http://shabbleland.myminicity.com/tra
> 

Reply via email to