C quiz questions/answers?

Furmanek, Greg plug-devel@lists.PLUG.phoenix.az.us
Mon Nov 5 16:56:00 2001


Have you introduced pointers in class?

There are some really cool tricks with pointers to 
pointers....

Greg

> -----Original Message-----
> From: Rob Wehrli [mailto:rwehrli@azpower.com]
> Sent: Monday, November 05, 2001 3:17 PM
> To: plug-devel@lists.PLUG.phoenix.az.us
> Subject: C quiz questions/answers?
> 
> 
> I've been writing an C "test" and thought that I'd ask the 
> list for any
> good traps/questions they might have...but not without at 
> least offering
> one.
> 
> #include <stdio.h>
> 
> int main( int argc, char * argv[] )
> {
>   int x = 100;
>   int i = 102;
> 
>   i < 100 ? x = i : x = 100;
> 
>   printf( "x = %d\n", x );
> 
>   return 0;
> }
> 
> 
> What is the output of the following program:
> 
> 
> A: Does not compile, does not execute.
> B: x = 100
> C: x = 102
> D: None of the above
> 
> IF A or D, explain your answer:
> 
> ____________________________________________
> 
> ____________________________________________
> 
> ____________________________________________
> 
> ____________________________________________
> 
> 
> 
> (No fair cheating and using a computer!)
> 
> 
> Take Care.
> 
> Rob!
> _______________________________________________
> PLUG-devel mailing list  -  PLUG-devel@lists.PLUG.phoenix.az.us
> http://lists.PLUG.phoenix.az.us/mailman/listinfo/plug-devel
> 


"The sender believes that this E-mail and any attachments were free of any
virus, worm, Trojan horse, and/or malicious code when sent.  This message
and its attachments could have been infected during transmission.  By
reading the message and opening any attachments, the recipient accepts full
responsibility for taking protective and remedial action about viruses and
other defects.  The sender's employer is not liable for any loss or damage
arising in any way from this message or its attachments."