Candidate Screening Challenges (Was: Crazy idea from a recruiter)

Dennis Muhlestein djmuhlestein at gmail.com
Thu Mar 28 16:43:19 MDT 2013


On 3/28/13 1:50 PM, Nicholas Leippe wrote:
> On Thu, Mar 28, 2013 at 12:40 PM, Sasha Pachev<sasha-cdsC3/u4GK9Wk0Htik3J/w at public.gmane.org>  wrote:

Does installing a signal handler disqualify?

# sig.cpp
#include <signal.h>
#include <stdio.h>

void sigfpe(int sig)
{
  printf("Hello World\n");
  signal(SIGFPE,NULL);
}

int main()
{
	int a,b;
	signal(SIGFPE, &sigfpe);
	a=b/0;
	return 0;
}

 > ./sig
Hello World
Floating point exception: 8


>>
>> can you make the following C code print "Hello, world" on  a
>> reasonable Unix platform by adding some actual code before it:
>>
>> a = b/0;
>>
>> ?
>
> printf("%s", "Hello, world!");
> fflush(NULL);
> a = b/0;
>
> prints it, but still causes a floating point exception. Did you
> specify this must be avoided? Deleting the div by zero line seems the
> better solution. :)
>
> I did notice the 1 bit difference between 43 and 11, but forgot you
> could declare specifically sized bit fields in C. I'm a bit rusty.
>
> /*
> PLUG: http://plug.org, #utah on irc.freenode.net
> Unsubscribe: http://plug.org/mailman/options/plug
> Don't fear the penguin.
> */
>



More information about the PLUG mailing list