Thread: Taking a Programming Test and need help with something.

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    28

    Taking a Programming Test and need help with something.

    First time posting and I would appreciate any input on what I should do.

    I learned to program (very recently) from the book c++ without fear and C++ something or other im at work dont have book, and come to find out I need 3 credit hours in order to fulfill my computer programming requirements for my degree (nuclear engineering tech.). The only classes they offer a test (ie tecep same as a clep) for is C programming, Qbasic and Basic. There is a c++ programming class however they require basic and c in order to meet the prerequisites. So instead of sitting through a class I want to test out of it.

    I have a link to what will be on the test and if I should go back and learn the little niches within C vice C++. Do you feel that I could pass with my C++ knowledge based on the link provided below on the test description.

    http://www.tesc.edu/catalog/tecep_desc/COS-116.pdf

    thank you guys ahead of time i really appreciate this website and board helped me a ton although i am mainly a spectator.

  2. #2
    Registered User ssharish2005's Avatar
    Join Date
    Sep 2005
    Location
    Cambridge, UK
    Posts
    1,732
    well, i dont think u will find that difficult with the question paper if know the C++. but still there few C specific fucntion like sacnf printf ftell and thinks like that. u got to be bit familier about few C lib... fucntions. rest of then they ask about the algorithma and some calcualtion and some advance. start programming C from today and get expereinced u wont find it diff...

    ssharish2005

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Like all online tests, they always seem to get something wrong, and this one is no exception.

    Q12
    Which of the following is an advantage of using macros over functions?
    A12
    Values passed to functions must be of a specific data type; values passed to macros do not.

    This is completely wrong.

    Consider
    Code:
    #include <stdio.h>
    
    // a totally unchecked macro
    #define LESS(a,b) a<b?a:b
    
    // a type checked function
    int less ( int a, int b ) {
      return a < b ? a : b;
    }
    
    int main ( ) {
      int a = 2, b = 4;
      int c, d;
      char *s, *t;
    
      // these work as expected
      c = less(a,b);
      d = LESS(a,b);
      printf( "%d %d\n", c, d );
    
      // this will fail to compile, or at the
      // very least draw lots of warnings.
      s = less ( "hello", "world" );
    
      // this will compile, may even produce the "expected" answer
      // but will randomly fail to give the right answer for less than obvious reasons
      t = LESS ( "hello", "world" );
      printf( "%s %s\n", s, t );
    
      return 0;
    }
    I don't regard the ability to silently introduce obscure and hard to find bugs into a program as an advantage.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Devil's Advocate SlyMaelstrom's Avatar
    Join Date
    May 2004
    Location
    Out of scope
    Posts
    4,079
    Quote Originally Posted by The Person Grading Salem's Test
    I... I'm sorry. The correct answer was C.
    *nyuck nyuck*

    Good point, though.
    Sent from my iPadŽ

  5. #5
    Registered User
    Join Date
    Mar 2006
    Posts
    28
    apologize about the cross post but i did not have problems answering the questions I was just doing a cover my @$$ type deal since i will be shelling over 184 dollars.

    I appreciate the answers guys and guess ill be purchasing a C book tonight on amazon and just ensure i know the little stuff.

    Thanks again for the replies guys very insightful and kinda skipped the cross posting deal, used to a lot bigger forum and never can really detect cross posts

    should i purchase the ansi c book or what would be a good cheaper book that'll atleast give me what i need for the time being.

Popular pages Recent additions subscribe to a feed