Taking a test for a job

Discussion in 'C Programming' started by Allan M. Bruce, May 26, 2006.

  1. I am applying for my first jobs after completing my PhD. I have been asked
    by a company to go and take a C programming test to see how my C skills are.
    Apparantly this test is mostly finding errors in small snippets of code but
    I was wondering if anyone could give me tips on what kind of things I should
    be looking out for. The one area I dont feel confident in is how to declare
    arrays of pointers and initialising multi-dimensional arrays.

    Any advice would be very welcome.

    Thanks
    Allan
     
    Allan M. Bruce, May 26, 2006
    #1
    1. Advertising

  2. "Allan M. Bruce" <> writes:
    > I am applying for my first jobs after completing my PhD. I have been asked
    > by a company to go and take a C programming test to see how my C skills are.
    > Apparantly this test is mostly finding errors in small snippets of code but
    > I was wondering if anyone could give me tips on what kind of things I should
    > be looking out for. The one area I dont feel confident in is how to declare
    > arrays of pointers and initialising multi-dimensional arrays.


    <http://www.c-faq.com/>, particularly section 6.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, May 26, 2006
    #2
    1. Advertising

  3. Allan M. Bruce

    Joe Wright Guest

    Allan M. Bruce wrote:
    > I am applying for my first jobs after completing my PhD. I have been asked
    > by a company to go and take a C programming test to see how my C skills are.
    > Apparantly this test is mostly finding errors in small snippets of code but
    > I was wondering if anyone could give me tips on what kind of things I should
    > be looking out for. The one area I dont feel confident in is how to declare
    > arrays of pointers and initialising multi-dimensional arrays.
    >
    > Any advice would be very welcome.
    >
    > Thanks
    > Allan
    >
    >

    Hi Allan.

    A PhD in what? CS?

    My advice would be to read more C books. Declaring arrays of pointers
    and initializing multi-dimensional arrays is straightforward.

    You can ask specific questions about C here in this newsgroup.

    --
    Joe Wright
    "Everything should be made as simple as possible, but not simpler."
    --- Albert Einstein ---
     
    Joe Wright, May 26, 2006
    #3
  4. "Joe Wright" <> wrote in message
    news:...
    > Allan M. Bruce wrote:
    >> I am applying for my first jobs after completing my PhD. I have been
    >> asked by a company to go and take a C programming test to see how my C
    >> skills are. Apparantly this test is mostly finding errors in small
    >> snippets of code but I was wondering if anyone could give me tips on what
    >> kind of things I should be looking out for. The one area I dont feel
    >> confident in is how to declare arrays of pointers and initialising
    >> multi-dimensional arrays.
    >>
    >> Any advice would be very welcome.
    >>
    >> Thanks
    >> Allan

    > Hi Allan.
    >
    > A PhD in what? CS?
    >
    > My advice would be to read more C books. Declaring arrays of pointers and
    > initializing multi-dimensional arrays is straightforward.
    >
    > You can ask specific questions about C here in this newsgroup.
    >


    My PhD is in Computing Science - more specifically Artificial Intelligence.
    Its been a while since I did any C programming, but I am fairly knowledgable
    as far as I know. I will dig out the old C books and have a look through
    them and then post back any problems I may encounter.

    Thanks
    Allan
     
    Allan M. Bruce, May 26, 2006
    #4
  5. Allan M. Bruce

    Ian Collins Guest

    Allan M. Bruce wrote:
    > I am applying for my first jobs after completing my PhD. I have been asked
    > by a company to go and take a C programming test to see how my C skills are.
    > Apparantly this test is mostly finding errors in small snippets of code but
    > I was wondering if anyone could give me tips on what kind of things I should
    > be looking out for. The one area I dont feel confident in is how to declare
    > arrays of pointers and initialising multi-dimensional arrays.
    >
    > Any advice would be very welcome.
    >

    An old favourite is questions about he arguments to printf and scanf.
    Have a look through this group's archives and see if you can answer most
    of the posted FAQs.

    --
    Ian Collins.
     
    Ian Collins, May 26, 2006
    #5
  6. Allan M. Bruce wrote:
    > "Joe Wright" <> wrote in message
    > news:...
    >> Allan M. Bruce wrote:
    >>> I am applying for my first jobs after completing my PhD. I have been
    >>> asked by a company to go and take a C programming test to see how my C
    >>> skills are. Apparantly this test is mostly finding errors in small
    >>> snippets of code but I was wondering if anyone could give me tips on what
    >>> kind of things I should be looking out for. The one area I dont feel
    >>> confident in is how to declare arrays of pointers and initialising
    >>> multi-dimensional arrays.
    >>>
    >>> Any advice would be very welcome.
    >>>
    >>> Thanks
    >>> Allan

    >> Hi Allan.
    >>
    >> A PhD in what? CS?
    >>
    >> My advice would be to read more C books. Declaring arrays of pointers and
    >> initializing multi-dimensional arrays is straightforward.
    >>
    >> You can ask specific questions about C here in this newsgroup.
    >>

    >
    > My PhD is in Computing Science - more specifically Artificial Intelligence.
    > Its been a while since I did any C programming, but I am fairly knowledgable
    > as far as I know. I will dig out the old C books and have a look through
    > them and then post back any problems I may encounter.

    I'd be curious to know what types of C books you hit along the way to
    your dissertation. frank
     
    Frank Silvermann, May 26, 2006
    #6
  7. >>
    >> My PhD is in Computing Science - more specifically Artificial
    >> Intelligence. Its been a while since I did any C programming, but I am
    >> fairly knowledgable as far as I know. I will dig out the old C books and
    >> have a look through them and then post back any problems I may encounter.

    > I'd be curious to know what types of C books you hit along the way to your
    > dissertation. frank


    None! The development was done completely in Java, although coding isnt very
    important in a PhD, its more about the ideas...
    Allan
     
    Allan M. Bruce, May 27, 2006
    #7
  8. Allan M. Bruce

    Ian Collins Guest

    Allan M. Bruce wrote:
    >>>My PhD is in Computing Science - more specifically Artificial
    >>>Intelligence. Its been a while since I did any C programming, but I am
    >>>fairly knowledgable as far as I know. I will dig out the old C books and
    >>>have a look through them and then post back any problems I may encounter.

    >>
    >>I'd be curious to know what types of C books you hit along the way to your
    >>dissertation. frank

    >
    >
    > None! The development was done completely in Java, although coding isnt very
    > important in a PhD, its more about the ideas...


    A decent employer should appreciate that and be more interested in your
    ability to contribute to their organisation, rather than your intimate
    knowledge of C.

    --
    Ian Collins.
     
    Ian Collins, May 27, 2006
    #8
  9. Ian Collins <> wrote:

    > A decent employer should appreciate that and be more interested in your
    > ability to contribute to their organisation, rather than your intimate
    > knowledge of C.


    Yes. I think there are plenty of people who have enough familiarity with
    language X to pass a test, but nevertheless are bad programmers.
    Hiring a C programmer who happens to have memorized every detail about
    printf() and scanf() is a bad idea, IMO. My advice to OP: Learn
    enough to get an interview, and if they can't figure out that you are
    a great programmer who merely is not a C guru, they probably aren't
    worth working for.

    --
    Christopher Benson-Manica | I *should* know what I'm talking about - if I
    ataru(at)cyberspace.org | don't, I need to know. Flames welcome.
     
    Christopher Benson-Manica, May 27, 2006
    #9
  10. Allan M. Bruce

    Malcolm Guest

    "Ian Collins" <> wrote
    > Allan M. Bruce wrote:
    >>>>My PhD is in Computing Science - more specifically Artificial
    >>>>Intelligence. Its been a while since I did any C programming, but I am
    >>>>fairly knowledgable as far as I know. I will dig out the old C books
    >>>>and
    >>>>have a look through them and then post back any problems I may
    >>>>encounter.
    >>>
    >>>I'd be curious to know what types of C books you hit along the way to
    >>>your
    >>>dissertation. frank

    >>
    >> None! The development was done completely in Java, although coding isnt
    >> very
    >> important in a PhD, its more about the ideas...

    >
    > A decent employer should appreciate that and be more interested in your
    > ability to contribute to their organisation, rather than your intimate
    > knowledge of C.
    >

    Exactly my thoughts.
    If you can program an artifical intellignece routine in Java then you can
    learn C.
    Unless you are desperate for any job, or unless it is a very small company
    with naive management, you probably want to be looking elsewhere.

    --
    Play Alice in Wonderland card game. (Windows only)
    www.personal.leeds.ac.uk/~bgy1mm
     
    Malcolm, May 27, 2006
    #10
  11. AI stuff, Was Re: Taking a test for a job

    "Allan M. Bruce" <> wrote in message
    news:eek:...
    >
    > "Joe Wright" <> wrote in message
    > news:...
    > > Allan M. Bruce wrote:
    > >> I am applying for my first jobs after completing my PhD.

    > >
    > > A PhD in what? CS?
    > >

    > My PhD is in Computing Science - more specifically Artificial

    Intelligence.
    >


    AI was a really popular topic in the early 90's. Despite learning some
    interesting stuff then, I haven't seen or heard of much since. Most of it
    was really primitive: attempting to model neurons, training weighted sum
    neural networks, etc. Since you have a PHD in AI, what are the things that
    you find most interesting?


    Rod Pemberton
     
    Rod Pemberton, May 27, 2006
    #11
  12. Re: AI stuff, Was Re: Taking a test for a job

    "Rod Pemberton" <> wrote in message
    news:e5925j$5g3$...
    >
    > "Allan M. Bruce" <> wrote in message
    > news:eek:...
    >>
    >> "Joe Wright" <> wrote in message
    >> news:...
    >> > Allan M. Bruce wrote:
    >> >> I am applying for my first jobs after completing my PhD.
    >> >
    >> > A PhD in what? CS?
    >> >

    >> My PhD is in Computing Science - more specifically Artificial

    > Intelligence.
    >>

    >
    > AI was a really popular topic in the early 90's. Despite learning some
    > interesting stuff then, I haven't seen or heard of much since. Most of it
    > was really primitive: attempting to model neurons, training weighted sum
    > neural networks, etc. Since you have a PHD in AI, what are the things
    > that
    > you find most interesting?
    >
    >
    > Rod Pemberton
    >
    >
    >


    Alas you are talking about Neural Networks which is a small area of AI
    which, as you said, was very popular about a decade ago. Our institution
    researches all fields fo AI, with topics including Model Learning, Natural
    Language Generation, Constraint Satisfaction, Planning, and my particular
    field Qualitative Reasoning.

    My PhD involved looking at Qualitative Reasoning (or 'thinking without
    numbers') and attempting to bridge the gap between it and standard numerical
    simulation. I also researched distributing all of the algorithms so that it
    can be used on parallel machines or in web services (the latest buzz word in
    academia).

    My interests for a job would include either Neural Networks or Qualitative
    Reasoning but I am also interested in many other fields, not necessarily
    what I studied.

    Allan
     
    Allan M. Bruce, May 27, 2006
    #12
  13. Allan M. Bruce

    pemo Guest

    Re: AI stuff, Was Re: Taking a test for a job

    Rod Pemberton wrote:
    > "Allan M. Bruce" <> wrote in message
    > news:eek:...
    >>
    >> "Joe Wright" <> wrote in message
    >> news:...
    >>> Allan M. Bruce wrote:
    >>>> I am applying for my first jobs after completing my PhD.
    >>>
    >>> A PhD in what? CS?
    >>>

    >> My PhD is in Computing Science - more specifically Artificial
    >> Intelligence.
    >>

    >
    > AI was a really popular topic in the early 90's. Despite learning
    > some interesting stuff then, I haven't seen or heard of much since.
    > Most of it was really primitive: attempting to model neurons,
    > training weighted sum neural networks, etc. Since you have a PHD in
    > AI, what are the things that you find most interesting?
    >
    >
    > Rod Pemberton



    As an ex-D.Phil [what Oxford calls a Ph.D. - we like to be different!]
    student in Computational Linguistics, I /suspect/ that Allan has used A.I.
    as a blanket term - as I used to do [it's the thing people have usually
    heard about]?

    What did surprise me is the Java - I would have bet a shed load of money on
    him citing Prolog!


    --
    ==============
    Not a pedant
    ==============
     
    pemo, May 27, 2006
    #13
  14. Re: AI stuff, Was Re: Taking a test for a job

    >>
    >> AI was a really popular topic in the early 90's. Despite learning
    >> some interesting stuff then, I haven't seen or heard of much since.
    >> Most of it was really primitive: attempting to model neurons,
    >> training weighted sum neural networks, etc. Since you have a PHD in
    >> AI, what are the things that you find most interesting?
    >>
    >>
    >> Rod Pemberton

    >
    >
    > As an ex-D.Phil [what Oxford calls a Ph.D. - we like to be different!]
    > student in Computational Linguistics, I /suspect/ that Allan has used A.I.
    > as a blanket term - as I used to do [it's the thing people have usually
    > heard about]?
    >
    > What did surprise me is the Java - I would have bet a shed load of money
    > on him citing Prolog!
    >
    >


    Indeed, Prolog is heavily used or certainly was, and Lisp. But as with
    everything, the trend at the moment is Java. I am glad though as my little
    prolog experience was not good!
    Allan
     
    Allan M. Bruce, May 27, 2006
    #14
  15. Re: AI stuff, Was Re: Taking a test for a job

    "Rod Pemberton" <> writes:
    > "Allan M. Bruce" <> wrote in message
    > news:eek:...

    [...]
    >> My PhD is in Computing Science - more specifically Artificial
    >> Intelligence.

    >
    > AI was a really popular topic in the early 90's. Despite learning some
    > interesting stuff then, I haven't seen or heard of much since. Most of it
    > was really primitive: attempting to model neurons, training weighted sum
    > neural networks, etc. Since you have a PHD in AI, what are the things that
    > you find most interesting?


    There's an entire hierarchy of comp.ai.* newsgroups where this kind of
    thing is topical.

    --
    Keith Thompson (The_Other_Keith) <http://www.ghoti.net/~kst>
    San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
    We must do something. This is something. Therefore, we must do this.
     
    Keith Thompson, May 27, 2006
    #15
  16. Re: AI stuff, Was Re: Taking a test for a job

    "Keith Thompson" <> wrote in message
    news:...
    > "Rod Pemberton" <> writes:
    > > "Allan M. Bruce" <> wrote in message
    > > news:eek:...

    > [...]
    > >> My PhD is in Computing Science - more specifically Artificial
    > >> Intelligence.

    > >
    > > AI was a really popular topic in the early 90's. Despite learning some
    > > interesting stuff then, I haven't seen or heard of much since. Most of

    it
    > > was really primitive: attempting to model neurons, training weighted sum
    > > neural networks, etc. Since you have a PHD in AI, what are the things

    that
    > > you find most interesting?

    >
    > There's an entire hierarchy of comp.ai.* newsgroups where this kind of
    > thing is topical.
    >


    As always, Keith stating the obvious and known in an ignorant and useless
    manner. If I wanted a response to my question from the generic AI populace,
    I would've asked there. But, I didn't. I wanted a response from someone
    who was extremely interested in AI (i.e., PHD) and upto date (i.e., new
    PHD). In other words, the individual who posted here.


    Rod Pemberton
     
    Rod Pemberton, May 27, 2006
    #16
  17. Allan M. Bruce

    Tomás Guest

    Allan M. Bruce posted:

    > I am applying for my first jobs after completing my PhD. I have been
    > asked by a company to go and take a C programming test to see how my C
    > skills are. Apparantly this test is mostly finding errors in small
    > snippets of code but I was wondering if anyone could give me tips on
    > what kind of things I should be looking out for. The one area I dont
    > feel confident in is how to declare arrays of pointers and
    > initialising multi-dimensional arrays.
    >
    > Any advice would be very welcome.



    I would approach it with this attitude: The person who wrote the exam is
    an absolute idiot, and it's my duty to show just how much of an idiot he
    is.

    Why?

    Because most programming language exams are erroneous. You might even see
    a question which has code that attemps to set all of an array's elements
    to zero:

    int *array[50];

    memset( &array, 0, sizeof( int[50] ) );


    You should give a very arrogant answer such as:


    The programmer errorneously overlooked the fact that not all zero values
    need be represented by all bits zero in memory; in particular: a null
    pointer value, 0 for a float or double. Therefore, the above code
    exhibits Undefined Behaviour.


    -Tomás
     
    Tomás, May 27, 2006
    #17
  18. Tomás said:

    > I would approach it with this attitude: The person who wrote the exam is
    > an absolute idiot, and it's my duty to show just how much of an idiot he
    > is.
    >
    > Why?
    >
    > Because most programming language exams are erroneous. You might even see
    > a question which has code that attemps to set all of an array's elements
    > to zero:
    >
    > int *array[50];
    >
    > memset( &array, 0, sizeof( int[50] ) );
    >
    >
    > You should give a very arrogant answer such as:
    >
    >
    > The programmer errorneously overlooked the fact that not all zero values
    > need be represented by all bits zero in memory; in particular: a null
    > pointer value, 0 for a float or double. Therefore, the above code
    > exhibits Undefined Behaviour.


    Not to mention the fact that array has type int *[50], so &array has type
    (int *[50])*. The appropriate sizeof would be sizeof(int *[50]) or sizeof
    array, not sizeof(int[50]). In my opinion this is a far graver error.

    --
    Richard Heathfield
    "Usenet is a strange place" - dmr 29/7/1999
    http://www.cpax.org.uk
    email: rjh at above domain (but drop the www, obviously)
     
    Richard Heathfield, May 27, 2006
    #18
  19. Tomás wrote:
    > Allan M. Bruce posted:
    >
    > > I am applying for my first jobs after completing my PhD. I have been
    > > asked by a company to go and take a C programming test to see how my C
    > > skills are. Apparantly this test is mostly finding errors in small
    > > snippets of code but I was wondering if anyone could give me tips on
    > > what kind of things I should be looking out for. The one area I dont
    > > feel confident in is how to declare arrays of pointers and
    > > initialising multi-dimensional arrays.
    > >
    > > Any advice would be very welcome.

    >
    >
    > I would approach it with this attitude: The person who wrote the exam is
    > an absolute idiot, and it's my duty to show just how much of an idiot he
    > is.
    >
    > Why?
    >
    > Because most programming language exams are erroneous. You might even see
    > a question which has code that attemps to set all of an array's elements
    > to zero:
    >
    > int *array[50];
    >
    > memset( &array, 0, sizeof( int[50] ) );
    >
    >
    > You should give a very arrogant answer such as:
    >
    >
    > The programmer errorneously overlooked the fact that not all zero values
    > need be represented by all bits zero in memory; in particular: a null
    > pointer value, 0 for a float or double. Therefore, the above code
    > exhibits Undefined Behaviour.


    After adding the missing *, I don't think there is undefined behaviour
    on any system just yet. The code sets all elements to all bits zero. If
    it's an invalid pointer value, there's not a problem until the pointers
    are actually read. (Sure, the code you've shown is then a very bad
    idea, but don't claim UB when there isn't.) If it's a valid null
    pointer, the code is unnecessarily nonportable, but correct for that
    implementation. And if all bits zero is a valid pointer value, but not
    a null pointer, and that special pointer value is needed, this may even
    be a good way of getting it.
     
    =?utf-8?B?SGFyYWxkIHZhbiBExLNr?=, May 27, 2006
    #19
  20. Allan M. Bruce

    Tomás Guest

    > The appropriate sizeof would be sizeof(int *[50])
    > or sizeof array, not sizeof(int[50]). In my opinion this is a far
    > graver error.



    One of the pitfalls of not checking over one's code.

    Thankfully though, there's a distinction between the sample code I post to
    newsgroups, and the real code I actually compile.


    -Tomás
     
    Tomás, May 27, 2006
    #20
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    0
    Views:
    693
  2. Julien Buratto

    [Job] Symbian C++ job

    Julien Buratto, Feb 3, 2004, in forum: C++
    Replies:
    2
    Views:
    588
    Julien Buratto
    Feb 3, 2004
  3. swordedotcom
    Replies:
    0
    Views:
    368
    swordedotcom
    Apr 23, 2006
  4. Skybuck Flying

    Call oddities: &Test() vs &Test vs Test

    Skybuck Flying, Oct 4, 2009, in forum: C Programming
    Replies:
    1
    Views:
    726
    Skybuck Flying
    Oct 4, 2009
  5. Jim Cain
    Replies:
    1
    Views:
    218
    Yukihiro Matsumoto
    Jul 18, 2003
Loading...

Share This Page