An Interview Question

Filed under: C++ — jac @ February 10, 2005 - 2:54 pm

Here’s some code stolen from The Daily WTF:

ushort GetAsciiValue (uchar ch)
{
    ushort i;
    for (i=0; i<=255; i++)
    {
        if(ch == i)
            return i;
    }
    return 0;
}

It might be interesting to show this code to a candidate for a C/C++ position. Ask him/her if there is anything wrong with this code, and if so, how he/she would implement GetAsciiValue.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>




  



March 2010
M T W T F S S
« Feb    
1234567
891011121314
15161718192021
22232425262728
293031  

Statistics

There are currently 42 posts and 25 comments, contained within 13 categories.


Miscellaneous
- Source Files

Add to Technorati Favorites


Storage B
-OpenDDS 2.1.1
-OpenDDS 2.1
-It Proved Just Too Difficult
-Bridge Simulators
-C++0x FAQ
-Skepticism and standards of evidence applied development practices
-OpenDDS 2.0.1
-OpenDDS 2.0
-OpenDDS Version 1.3 Released
-LGPL License Option Added to Qt

Valid XHTML 1.0!

Valid CSS!