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.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(required)

(required)





  



November 2008
M T W T F S S
« Aug    
 12
3456789
10111213141516
17181920212223
24252627282930

Statistics

There are currently 31 posts and 16 comments, contained within 12 categories.


Miscellaneous
- Source Files

Add to Technorati Favorites



Storage B
-OpenDDS Version 1.2 Released
-FreeVMS
-OpenDDS Version 1.1 Released
-C++ functions to convert between decimal degrees and degrees, minutes, and seconds
-WordPress 2.5
-Multics
-C++ Functions to Evaluate Chebyshev Polynomials
-OpenDDS
-X Windows Programming in C++: Part III
-X Windows Programming in C++: Part II

Valid XHTML 1.0!

Valid CSS!