Author Topic: Pre-employment problem solving ability tests  (Read 6103 times)

RevDisk

  • friend
  • Senior Member
  • ***
  • Posts: 12,633
    • RevDisk.net
Re: Pre-employment problem solving ability tests
« Reply #25 on: August 29, 2013, 02:56:55 PM »
seq 100|perl -ne'$_%5?$_%3?print:say"Fizz":$_%3?say"Buzz":say"FizzBuzz"'

Best I could do on lunch. You have to use perl 5.10 to get the 'say' to work; it works the same with 'print"foo\n"' it's just longer.

perl-5.10.1-131.el6_4.x86_64 already installed and latest version
[root@fwireport01 reports]# seq 100|perl -ne'$_%5?$_%3?print:say"Fizz":$_%3?say"Buzz":say"FizzBuzz"'
String found where operator expected at -e line 1, near "say"Fizz""
String found where operator expected at -e line 1, near "say"Buzz""
String found where operator expected at -e line 1, near "say"FizzBuzz""
syntax error at -e line 1, near "say"Fizz""
Execution of -e aborted due to compilation errors.


seq 100|perl -ne'if ($_%3==0){print( "Fizz")};if ($_%5==0){print( "Buzz")};if(($_%3 ne 0)and($_%5 ne 0)){print($_)};print("\n");'

zahc is still cooler than me.  =D
"Rev, your picture is in my King James Bible, where Paul talks about "inventors of evil."  Yes, I know you'll take that as a compliment."  - Fistful, possibly highest compliment I've ever received.

cosine

  • Administrator
  • Senior Member
  • *****
  • Posts: 3,734
Re: Pre-employment problem solving ability tests
« Reply #26 on: August 29, 2013, 03:19:57 PM »
Personal stats for using Perl:
+10 geek cred
-100 for cryptic code

 =D
Andy

Tallpine

  • friends
  • Senior Member
  • ***
  • Posts: 23,172
  • Grumpy Old Grandpa
Re: Pre-employment problem solving ability tests
« Reply #27 on: August 29, 2013, 05:00:35 PM »
Personal stats for using Perl:
+10 geek cred
-100 for cryptic code

 =D


It's more important that somebody can figure it out two or five or ten years later after you've moved on to greener pastures.
Freedom is a heavy load, a great and strange burden for the spirit to undertake. It is not easy. It is not a gift given, but a choice made, and the choice may be a hard one. The road goes upward toward the light; but the laden traveller may never reach the end of it.  - Ursula Le Guin

zahc

  • friend
  • Senior Member
  • ***
  • Posts: 5,814
Re: Pre-employment problem solving ability tests
« Reply #28 on: August 29, 2013, 06:08:49 PM »
perl-5.10.1-131.el6_4.x86_64 already installed and latest version
[root@fwireport01 reports]# seq 100|perl -ne'$_%5?$_%3?print:say"Fizz":$_%3?say"Buzz":say"FizzBuzz"'
String found where operator expected at -e line 1, near "say"Fizz""
String found where operator expected at -e line 1, near "say"Buzz""
String found where operator expected at -e line 1, near "say"FizzBuzz""
syntax error at -e line 1, near "say"Fizz""
Execution of -e aborted due to compilation errors.


Having 5.10 installed is irrelevant; perl will not compile 5.10 features like 'say' unless you tweak your perl to be quiet. You can also prepend 'use v5.10;'. I have no idea why this is; I think the perl developers deliberately make it easy to get new bug fixes and hard to use new incompatible features.
Maybe a rare occurence, but then you only have to get murdered once to ruin your whole day.
--Tallpine

Jim147

  • friends
  • Senior Member
  • ***
  • Posts: 7,611
Re: Pre-employment problem solving ability tests
« Reply #29 on: August 30, 2013, 12:04:21 AM »
I always found the best way to test new hires was to bug stuff with common problems and see how they went about solving them.

Fixing it wasn't as important as how. Some injunears really like to over think and over spend to fix a simple problem.

jim
Sometimes we carry more weight then we owe.
And sometimes goes on and on and on.

BAH-WEEP-GRAAAGHNAH WHEEP NI-NI BONG

Tallpine

  • friends
  • Senior Member
  • ***
  • Posts: 23,172
  • Grumpy Old Grandpa
Re: Pre-employment problem solving ability tests
« Reply #30 on: August 30, 2013, 10:29:44 AM »
I always found the best way to test new hires was to bug stuff with common problems and see how they went about solving them.

Fixing it wasn't as important as how. Some injunears really like to over think and over spend to fix a simple problem.

jim

The first rule of fixing code bugs is to NOT introduce ten new ones  =(
Freedom is a heavy load, a great and strange burden for the spirit to undertake. It is not easy. It is not a gift given, but a choice made, and the choice may be a hard one. The road goes upward toward the light; but the laden traveller may never reach the end of it.  - Ursula Le Guin

RevDisk

  • friend
  • Senior Member
  • ***
  • Posts: 12,633
    • RevDisk.net
Re: Pre-employment problem solving ability tests
« Reply #31 on: August 30, 2013, 11:54:05 AM »
The first rule of fixing code bugs is to NOT introduce ten new ones  =(

Unless you are paid to remove bugs.

And the first rule of Indian coding is "if it compiles, ship it". Applies to bugs as well.
"Rev, your picture is in my King James Bible, where Paul talks about "inventors of evil."  Yes, I know you'll take that as a compliment."  - Fistful, possibly highest compliment I've ever received.

Tallpine

  • friends
  • Senior Member
  • ***
  • Posts: 23,172
  • Grumpy Old Grandpa
Re: Pre-employment problem solving ability tests
« Reply #32 on: August 30, 2013, 12:37:40 PM »
Unless you are paid to remove bugs.

And the first rule of Indian coding is "if it compiles, ship it". Applies to bugs as well.

Yeah  :mad:

I used to like this business, back when I wrote code myself.  Trying to ride herd on a bunch of morons is frustrating.
Freedom is a heavy load, a great and strange burden for the spirit to undertake. It is not easy. It is not a gift given, but a choice made, and the choice may be a hard one. The road goes upward toward the light; but the laden traveller may never reach the end of it.  - Ursula Le Guin

cordex

  • Administrator
  • Senior Member
  • *****
  • Posts: 8,736
Re: Pre-employment problem solving ability tests
« Reply #33 on: August 30, 2013, 01:44:11 PM »
And the first rule of Indian coding is "if it compiles, ship it". Applies to bugs as well.
They check to see if it compiles these days?

Marnoot

  • friend
  • Senior Member
  • ***
  • Posts: 2,965
Re: Pre-employment problem solving ability tests
« Reply #34 on: August 30, 2013, 11:12:18 PM »
They check to see if it compiles these days?

We enforce it on our Indian contractors via gated check-in on the build and source-control servers. It won't let them check in their code if it doesn't compile. Unfortunately, as discussed, sometimes compiling is about all the code does that's good.
« Last Edit: August 30, 2013, 11:18:11 PM by Marnoot »