[kwlug-disc] how would you interview potential linux employees?

Chris Frey cdfrey at foursquare.net
Tue Jan 27 17:49:43 EST 2009


On Tue, Jan 27, 2009 at 04:27:27PM -0500, Andrew Kohlsmith (lists) wrote:
> int s, done;
> 
> s=done=0;
> do {
> 	switch(s)
> 	case 0:
> 		printf("zero\n");
> 		s += 5;
> 		break;
> 	case 1:
> 		printf("one\n");
> 		s = s << 1;
> 		break;
> 	case 2:
> 		printf("two\n");
> 		s *= 2;
> 	case 3:
> 		printf("three\n");
> 		s = 2;
> 	case 4:
> 		printf("four\n");
> 		s += 2;
> 		break;
> 	case 5:
> 		printf("five\n");
> 		s -= 4;
> 		break;
> 	case 6:
> 		printf("six\n");
> 		s = 
> 		break;
> 	}
> 	done = s % 6;
> } while(!done);

The average linux user would be confused.

The adventurous linux user would try to compile it and get an error about
a missing main().

The non-paranoid programming linux user would add a default main() block,
try to compile it, and get an error about an incomplete statement in
case 6.

The paranoid programmer would read the code carefully, and see that it is
safe, but won't compile.

The pointy haired boss would expect the answer:

	zero
	five
	one
	two
	four
	six

... and not hire any of them. ;-)

- Chris





More information about the kwlug-disc mailing list