Online C Programming Quizzes

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Dexter

    #1

    Online C Programming Quizzes

    My site is home to series of quizzes ranging from Accounting,
    Business, Math to programming languages. These are multiple choice
    type questions and you get a score card at end.

    For C language, I have 3 set of quizzes that anyone is welcome to try
    online for free.
    Questions on C quizzes are rather easy to solve for Professional C
    programmers yet for those who are taking C as a first programming
    course will find these useful in assesment their C
    knowledge


    Visit http://www.thinkanddone.com/exams/main.aspx


    Regards


    Asad S. Yousaf

  • Army1987

    #2
    Re: Online C Programming Quizzes

    On Sat, 06 Oct 2007 00:22:53 -0700, Dexter wrote:
    My site is home to series of quizzes ranging from Accounting,
    Business, Math to programming languages. These are multiple choice
    type questions and you get a score card at end.
    >
    For C language, I have 3 set of quizzes that anyone is welcome to try
    online for free.
    Questions on C quizzes are rather easy to solve for Professional C
    programmers yet for those who are taking C as a first programming
    course will find these useful in assesment their C
    knowledge
    >
    >
    Visit http://www.thinkanddone.com/exams/main.aspx
    I found something wrong already at the first level.
    Question 3 is:
    3 . Its given that variable x has been assigned a value of 5, which of the following statement will output the message "I am quite right"
    if (x!=5) printf("I am quite right");
    if (x=5) printf("I am quite right");
    both statements will display the message
    none of the above
    The second statement will assign 5 to x (which happens to already
    have that value, but that's irrelevant) and, since the result of
    that assignment can never be zero, it will execute the expression
    statement consisting of the printf call. So I checked the second
    answer, but the test believes the correct answer to be "none of
    the above".

    --
    Army1987 (Replace "NOSPAM" with "email")
    A hamburger is better than nothing.
    Nothing is better than eternal happiness.
    Therefore, a hamburger is better than eternal happiness.

    Comment

    • borophyll@gmail.com

      #3
      Re: Online C Programming Quizzes

      On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
      My site is home to series of quizzes ranging from Accounting,
      Business, Math to programming languages. These are multiple choice
      type questions and you get a score card at end.
      >
      For C language, I have 3 set of quizzes that anyone is welcome to try
      online for free.
      Questions on C quizzes are rather easy to solve for Professional C
      programmers yet for those who are taking C as a first programming
      course will find these useful in assesment their C
      knowledge
      >
      Visithttp://www.thinkanddon e.com/exams/main.aspx
      >
      Regards
      >
      Asad S. Yousaf
      Some of the questions could be better worded, and some of the
      questions are just plain wrong.

      --------------
      Dataset 1
      --------------

      Question 1 states: A C program is a collection of ______________
      (a) arrays
      (b) variables
      (c) functions
      (d) data types

      Neither of these answers are correct, though you state that (c) is the
      answer. A C program is more than a collection of functions. What
      about object declarations? Type declarations? The correct answer
      should be "declaratio ns".

      Question 3 states: Its given that variable x has been assigned a value
      of 5, which of the following statement will output the message "I am
      quite right"

      (a) if (x!=5) printf("I am quite right");
      (b) if (x=5) printf("I am quite right");
      (c) both statements will display the message
      (d) none of the above

      You give answer (d) as the correct answer, when in fact the correct
      answer is (b). Remember, assignment expressions have a value too...

      Question 6: I don't like the wording of this question. The term
      "assignment " here I think is not really correct

      ---------------
      Dataset 2
      ---------------

      Question 1: This may just be a language barrier issue, but
      "alphabets" should be "letters"

      Question 5: I'm not sure that you should be so dogmatic about the use
      of infinite loops. They should not be used if you can avoid them, but
      I know Linux uses them a lot. Perhaps there are cases where you need
      to use them...

      Question 8: This may be bit-picking, but my interpretation of the
      Standard is that void actually *is* a value, but it is an empty value
      that cannot be used. I would be interested to know why this
      description was used. Why not just say void means "returning no value"

      Question 9: Sorry, your answer is wrong. You declare an array of 10
      characters. You can fit 10 characters in it. The answer is not 9.
      There is no rule that the last element of an array of char must be a
      null character. And even if there was, the null character is *still*
      a character!

      --------------
      Dataset 3
      --------------

      Question 2: Replace the word "commands" with "directives "

      Question 3: Where is the condition contained in round brackets?

      Question 6: Answer (d) is correct, not answer (c)

      Question 7: Answer (c) is given as correct, but goto is not a loop
      statement

      Question 8: A function *always* returns one value. Just because it
      is a pointer does not mean that it returns *many* values

      Question 9: All arguments are pass by value

      Question 10: 12 bytes is incorrect. The value is implementation
      defined, because a structure may have any amount of padding between
      its members or following the last member.


      Regards,
      B.

      Comment

      • pete

        #4
        Re: Online C Programming Quizzes

        borophyll@gmail .com wrote:
        Question 8: This may be bit-picking, but my interpretation of the
        Standard is that void actually *is* a value, but it is an empty value
        that cannot be used.
        An expression of type void has a nonexistent value,
        which to my way of thinking,
        means that expressions of type void don't have values.

        N869
        6.3.2.2 void
        [#1] The (nonexistent) value of a void expression (an
        expression that has type void) shall not be used in any way,
        and implicit or explicit conversions (except to void) shall
        not be applied to such an expression.

        --
        pete

        Comment

        • pete

          #5
          Re: Online C Programming Quizzes

          borophyll@gmail .com wrote:
          >
          On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
          Visithttp://www.thinkanddon e.com/exams/main.aspx
          Some of the questions could be better worded, and some of the
          questions are just plain wrong.
          >
          --------------
          Dataset 1
          --------------
          >
          Question 1 states: A C program is a collection of ______________
          (a) arrays
          (b) variables
          (c) functions
          (d) data types
          >
          Neither of these answers are correct, though you state that (c) is the
          answer. A C program is more than a collection of functions. What
          about object declarations? Type declarations? The correct answer
          should be "declaratio ns".
          External declarations.

          A C program consists of:
          1 preprocessor directives
          2 comments
          3 external declarations
          4 extra white space

          --
          pete

          Comment

          • borophyll@gmail.com

            #6
            Re: Online C Programming Quizzes

            On Oct 6, 6:43 pm, pete <pfil...@mindsp ring.comwrote:
            boroph...@gmail .com wrote:
            Question 8: This may be bit-picking, but my interpretation of the
            Standard is that void actually *is* a value, but it is an empty value
            that cannot be used.
            >
            An expression of type void has a nonexistent value,
            which to my way of thinking,
            means that expressions of type void don't have values.
            >
            N869
            6.3.2.2 void
            [#1] The (nonexistent) value of a void expression (an
            expression that has type void) shall not be used in any way,
            and implicit or explicit conversions (except to void) shall
            not be applied to such an expression.
            >
            --
            pete
            Agreed, I was too lazy to look it up properly

            Comment

            • Flash Gordon

              #7
              Re: Online C Programming Quizzes

              pete wrote, On 06/10/07 09:47:
              borophyll@gmail .com wrote:
              >On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
              >
              >>Visithttp://www.thinkanddon e.com/exams/main.aspx
              >
              >Some of the questions could be better worded, and some of the
              >questions are just plain wrong.
              >>
              >--------------
              >Dataset 1
              >--------------
              >>
              >Question 1 states: A C program is a collection of ______________
              >(a) arrays
              >(b) variables
              >(c) functions
              >(d) data types
              >>
              >Neither of these answers are correct, though you state that (c) is the
              >answer. A C program is more than a collection of functions. What
              >about object declarations? Type declarations? The correct answer
              >should be "declaratio ns".
              >
              External declarations.
              >
              A C program consists of:
              1 preprocessor directives
              2 comments
              3 external declarations
              4 extra white space
              To get a C program you need at least one definition (although a
              definition is of course also a declaration). If your are including
              comments in your list, then why not statements?
              --
              Flash Gordon

              Comment

              • pete

                #8
                Re: Online C Programming Quizzes

                Flash Gordon wrote:
                >
                pete wrote, On 06/10/07 09:47:
                borophyll@gmail .com wrote:
                On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                >Visithttp://www.thinkanddon e.com/exams/main.aspx
                Some of the questions could be better worded, and some of the
                questions are just plain wrong.
                >
                --------------
                Dataset 1
                --------------
                >
                Question 1 states: A C program is a collection of ______________
                (a) arrays
                (b) variables
                (c) functions
                (d) data types
                >
                Neither of these answers are correct, though you state that (c) is the
                answer. A C program is more than a collection of functions. What
                about object declarations? Type declarations? The correct answer
                should be "declaratio ns".
                External declarations.

                A C program consists of:
                1 preprocessor directives
                2 comments
                3 external declarations
                4 extra white space
                >
                To get a C program you need at least one definition (although a
                definition is of course also a declaration). If your are including
                comments in your list, then why not statements?
                Because statments are part of function definitions
                and function definitions are external declarations.

                --
                pete

                Comment

                • pete

                  #9
                  Re: Online C Programming Quizzes

                  pete wrote:
                  >
                  Flash Gordon wrote:

                  pete wrote, On 06/10/07 09:47:
                  borophyll@gmail .com wrote:
                  >On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                  >
                  >>Visithttp://www.thinkanddon e.com/exams/main.aspx
                  >
                  >Some of the questions could be better worded, and some of the
                  >questions are just plain wrong.
                  >>
                  >--------------
                  >Dataset 1
                  >--------------
                  >>
                  >Question 1 states: A C program is a collection of ______________
                  >(a) arrays
                  >(b) variables
                  >(c) functions
                  >(d) data types
                  >>
                  >Neither of these answers are correct,
                  >though you state that (c) is the
                  >answer. A C program is more than
                  >a collection of functions. What
                  >about object declarations? Type declarations?
                  >The correct answer should be "declaratio ns".
                  >
                  External declarations.
                  >
                  A C program consists of:
                  1 preprocessor directives
                  2 comments
                  3 external declarations
                  4 extra white space
                  To get a C program you need at least one definition (although a
                  definition is of course also a declaration). If your are including
                  comments in your list, then why not statements?
                  >
                  Because statments are part of function definitions
                  and function definitions are external declarations.
                  N869

                  6.9 External definitions

                  [#4] As discussed in 5.1.1.1, the unit of program text after
                  preprocessing is a translation unit, which consists of a
                  sequence of external declarations.

                  --
                  pete

                  Comment

                  • borophyll@gmail.com

                    #10
                    Re: Online C Programming Quizzes

                    On Oct 6, 8:27 pm, pete <pfil...@mindsp ring.comwrote:
                    pete wrote:
                    >
                    Flash Gordon wrote:
                    >
                    pete wrote, On 06/10/07 09:47:
                    boroph...@gmail .com wrote:
                    On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                    >
                    >Visithttp://www.thinkanddon e.com/exams/main.aspx
                    >
                    Some of the questions could be better worded, and some of the
                    questions are just plain wrong.
                    >
                    --------------
                    Dataset 1
                    --------------
                    >
                    Question 1 states: A C program is a collection of ______________
                    (a) arrays
                    (b) variables
                    (c) functions
                    (d) data types
                    >
                    Neither of these answers are correct,
                    though you state that (c) is the
                    answer. A C program is more than
                    a collection of functions. What
                    about object declarations? Type declarations?
                    The correct answer should be "declaratio ns".
                    >
                    External declarations.
                    >
                    A C program consists of:
                    1 preprocessor directives
                    2 comments
                    3 external declarations
                    4 extra white space
                    >
                    To get a C program you need at least one definition (although a
                    definition is of course also a declaration). If your are including
                    comments in your list, then why not statements?
                    >
                    Because statments are part of function definitions
                    and function definitions are external declarations.
                    >
                    N869
                    >
                    6.9 External definitions
                    >
                    [#4] As discussed in 5.1.1.1, the unit of program text after
                    preprocessing is a translation unit, which consists of a
                    sequence of external declarations.
                    >
                    --
                    pete
                    The question would need to be qualified as "preprocess ed C program"
                    for it to be precise

                    Regards,
                    B.

                    Comment

                    • Dexter

                      #11
                      Re: Online C Programming Quizzes

                      On Oct 6, 1:10 pm, Army1987 <army1...@NOSPA M.itwrote:
                      On Sat, 06 Oct 2007 00:22:53 -0700, Dexter wrote:
                      My site is home to series of quizzes ranging from Accounting,
                      Business, Math to programming languages. These are multiple choice
                      type questions and you get a score card at end.
                      >
                      For C language, I have 3 set of quizzes that anyone is welcome to try
                      online for free.
                      Questions on C quizzes are rather easy to solve for Professional C
                      programmers yet for those who are taking C as a first programming
                      course will find these useful in assesment their C
                      knowledge
                      >
                      Visithttp://www.thinkanddon e.com/exams/main.aspx
                      >
                      I found something wrong already at the first level.
                      Question 3 is:
                      3 . Its given that variable x has been assigned a value of 5, which of the following statement will output the message "I am quite right"
                      if (x!=5) printf("I am quite right");
                      if (x=5) printf("I am quite right");
                      both statements will display the message
                      none of the above
                      The second statement will assign 5 to x (which happens to already
                      have that value, but that's irrelevant) and, since the result of
                      that assignment can never be zero, it will execute the expression
                      statement consisting of the printf call. So I checked the second
                      answer, but the test believes the correct answer to be "none of
                      the above".
                      >
                      --
                      Army1987 (Replace "NOSPAM" with "email")
                      A hamburger is better than nothing.
                      Nothing is better than eternal happiness.
                      Therefore, a hamburger is better than eternal happiness.
                      I made errors when compiling the examset. Many thanks for your insight
                      into C topics

                      I have reloaded DataSet1 with error proned question replaced with new
                      ones.

                      DataSet2 and Dataset3 have been unloaded and will be corrected and
                      reloaded later this afternoon

                      Comment

                      • Army1987

                        #12
                        Re: Online C Programming Quizzes

                        On Sat, 06 Oct 2007 05:44:06 -0700, Dexter wrote:
                        On Oct 6, 1:10 pm, Army1987 <army1...@NOSPA M.itwrote:
                        >On Sat, 06 Oct 2007 00:22:53 -0700, Dexter wrote:
                        My site is home to series of quizzes ranging from Accounting,
                        Business, Math to programming languages. These are multiple choice
                        type questions and you get a score card at end.
                        >>
                        For C language, I have 3 set of quizzes that anyone is welcome to try
                        online for free.
                        Questions on C quizzes are rather easy to solve for Professional C
                        programmers yet for those who are taking C as a first programming
                        course will find these useful in assesment their C
                        knowledge
                        >>
                        Visithttp://www.thinkanddon e.com/exams/main.aspx
                        >>
                        >I found something wrong already at the first level.
                        >Question 3 is:
                        >3 . Its given that variable x has been assigned a value of 5, which of the following statement will output the message "I am quite right"
                        >if (x!=5) printf("I am quite right");
                        >if (x=5) printf("I am quite right");
                        >both statements will display the message
                        >none of the above
                        >The second statement will assign 5 to x (which happens to already
                        >have that value, but that's irrelevant) and, since the result of
                        >that assignment can never be zero, it will execute the expression
                        >statement consisting of the printf call. So I checked the second
                        >answer, but the test believes the correct answer to be "none of
                        >the above".
                        >>
                        I made errors when compiling the examset. Many thanks for your insight
                        into C topics
                        >
                        I have reloaded DataSet1 with error proned question replaced with new
                        ones.
                        I think that the point you were trying to verify with that
                        question, namely the difference between comparison and assignment,
                        is important, but using zeroes instead of fives you could verify
                        it without the test expecting a factually incorrect answer.
                        --
                        Army1987 (Replace "NOSPAM" with "email")
                        A hamburger is better than nothing.
                        Nothing is better than eternal happiness.
                        Therefore, a hamburger is better than eternal happiness.

                        Comment

                        • Army1987

                          #13
                          Re: Online C Programming Quizzes

                          On Sat, 06 Oct 2007 04:47:25 -0400, pete wrote:
                          borophyll@gmail .com wrote:
                          >>
                          >On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                          >
                          Visithttp://www.thinkanddon e.com/exams/main.aspx
                          >
                          >Some of the questions could be better worded, and some of the
                          >questions are just plain wrong.
                          >>
                          >--------------
                          >Dataset 1
                          >--------------
                          >>
                          >Question 1 states: A C program is a collection of ______________
                          >(a) arrays
                          >(b) variables
                          >(c) functions
                          >(d) data types
                          >>
                          >Neither of these answers are correct, though you state that (c) is the
                          >answer. A C program is more than a collection of functions. What
                          >about object declarations? Type declarations? The correct answer
                          >should be "declaratio ns".
                          >
                          External declarations.
                          >
                          A C program consists of:
                          1 preprocessor directives
                          2 comments
                          3 external declarations
                          4 extra white space
                          You should make up your mind. Is the program the set of
                          preprocessing-files or of (preprocessed) translation units? In the
                          former case, they are made by groups of lines, and each line is
                          either a directive or it isn't. At this level, doing that
                          distinction is not very useful, as external declarations could be
                          built with macros and/or other IOCCC preprocessing trickery.
                          In the latter case, after preprocessing (translation phases 1-4)
                          there are no more comments, and translation units are made of
                          external declarations. See A.2.4 and A.3.

                          --
                          Army1987 (Replace "NOSPAM" with "email")
                          A hamburger is better than nothing.
                          Nothing is better than eternal happiness.
                          Therefore, a hamburger is better than eternal happiness.

                          Comment

                          • Army1987

                            #14
                            Re: Online C Programming Quizzes

                            On Sat, 06 Oct 2007 08:18:57 +0000, borophyll wrote:
                            On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                            >For C language, I have 3 set of quizzes that anyone is welcome to try
                            >online for free.
                            >Questions on C quizzes are rather easy to solve for Professional C
                            >programmers yet for those who are taking C as a first programming
                            >course will find these useful in assesment their C
                            >knowledge
                            >>
                            >Visithttp://www.thinkanddon e.com/exams/main.aspx
                            Some of the questions could be better worded, and some of the
                            questions are just plain wrong.
                            >
                            --------------
                            Dataset 1
                            --------------
                            Question 6: I don't like the wording of this question. The term
                            "assignment " here I think is not really correct
                            Well, ++E is defined in terms of (E+=1), so the distinction is
                            really immaterial.
                            ---------------
                            Dataset 2
                            ---------------
                            Question 9: Sorry, your answer is wrong. You declare an array of 10
                            characters. You can fit 10 characters in it. The answer is not 9.
                            There is no rule that the last element of an array of char must be a
                            null character. And even if there was, the null character is *still*
                            a character!
                            IIRC it talks about strings. Anyway, since the null is part of the
                            string, but the length of a string is defined as the number of
                            characters excluding the null, the wording shoul be "of length 9"
                            not "of 9 characters".
                            --
                            Army1987 (Replace "NOSPAM" with "email")
                            A hamburger is better than nothing.
                            Nothing is better than eternal happiness.
                            Therefore, a hamburger is better than eternal happiness.

                            Comment

                            • pete

                              #15
                              Re: Online C Programming Quizzes

                              Army1987 wrote:
                              >
                              On Sat, 06 Oct 2007 04:47:25 -0400, pete wrote:
                              >
                              borophyll@gmail .com wrote:
                              >
                              On Oct 6, 5:22 pm, Dexter <yousaf.a...@gm ail.comwrote:
                              Visithttp://www.thinkanddon e.com/exams/main.aspx
                              Some of the questions could be better worded, and some of the
                              questions are just plain wrong.
                              >
                              --------------
                              Dataset 1
                              --------------
                              >
                              Question 1 states: A C program is a collection of ______________
                              (a) arrays
                              (b) variables
                              (c) functions
                              (d) data types
                              >
                              Neither of these answers are correct,
                              though you state that (c) is the
                              answer. A C program is more than a collection of functions. What
                              about object declarations? Type declarations? The correct answer
                              should be "declaratio ns".
                              External declarations.

                              A C program consists of:
                              1 preprocessor directives
                              2 comments
                              3 external declarations
                              4 extra white space
                              You should make up your mind. Is the program the set of
                              preprocessing-files or of (preprocessed) translation units?
                              No.
                              A program is the source files.
                              Have you ever written a C program?

                              N869
                              5.1.1.1 Program structure
                              [#1] A C program need not all be translated at the same
                              time. The text of the program is kept in units called
                              source files, (or preprocessing files) in this International
                              Standard.

                              --
                              pete

                              Comment

                              Working...