From: Additya on
Hello friends ,
If you do want to test your C Skills online, this Quiz is for you.
It is a multiple choice objective list of some good questions on C
collected from placement papers of various software companies.
Click below to take the quiz

http://www.ezdia.com//Quiz-on-C-Programming/Content.do?id=1420

Hope you find this useful
From: Keith Thompson on
Additya <addy.ind(a)gmail.com> writes:
> If you do want to test your C Skills online, this Quiz is for you.
> It is a multiple choice objective list of some good questions on C
> collected from placement papers of various software companies.
> Click below to take the quiz
>
> http://www.ezdia.com//Quiz-on-C-Programming/Content.do?id=1420
>
> Hope you find this useful

Not too bad; it's better than most such quizzes I've seen.

In question "Which one of the following provides conceptual support
for function calls?", none of the answers are actually things defined
by the standard. (There is one answer that's probably more "correct"
than the others, at least on most systems.)

None of the answers to "Which one of the following will declare a
pointer to an integer at address 0x200 in memory?" are correct,
though one of them *might* be accepted with a warning by some
compilers.

The answers to the question "According to the Standard C
specification, what are the respective minimum sizes (in bytes)
of the following three data types: short; int; and long?" seem
to assume that a byte is 8 bits. The correct answer is 1, 1, 1,
though this can occur only on a system with CHAR_BIT >= 32.

I just finished the quiz and submitted my answers, but it doesn't
bother to tell me which answers are considered correct; there's just
a screen that shows how others have answered. That's appropriate
for a poll, but not for a quiz.

I was going to post this on the web site, but I'm not interested
in registering and accepting the terms to do so.

--
Keith Thompson (The_Other_Keith) kst-u(a)mib.org <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
From: Jerry Coffin on
In article <2fadb909-3cc8-4aa2-b757-a2c33b7558e3
@m27g2000prl.googlegroups.com>, addy.ind(a)gmail.com says...
>
> Hello friends ,
> If you do want to test your C Skills online, this Quiz is for you.
> It is a multiple choice objective list of some good questions on C
> collected from placement papers of various software companies.
> Click below to take the quiz
>
> http://www.ezdia.com//Quiz-on-C-Programming/Content.do?id=1420

I'll point out a few problems in addition to those Keith already
posted.

> What is a difference between a declaration and a definition of a
> variable?

None of the answers provided is entirely accurate. In particular, C
has the concept of a "tentative definition", which (sort of) allows a
number of definitions of a variable. See ยง6.9.2/2 of the C99 standard
for details.

> If a variable has been declared with file scope, as above, can it
> safely be accessed globally from another file?

Though it's pretty clear which answer is supposed to be correct,
you'd use an "extern declaration". Your answer used the phrase
"extern specifier", which has a perfectly valid meaning in C, but
doesn't refer to a complete extern declaration. In fairness, you have
to get pretty pedantic to notice or care about this defect though.

Though Keith already pointed it out, I'll add a further comment on:

> Which one of the following provides conceptual support for function
> calls?

None of this is really defined by C -- depending on the processor,
what we usually call a stack frame can be built on what we'd normally
think of as a stack (e.g., on x86), or in registers (e.g., on SPARC)
or on the heap (e.g., on most IBM mainframes). Although the registers
and dynamically allocated blocks from the heap are used in a stack-
like fashion, demanding that somebody recognize this as "The system
stack" is a bit of a stretch, IMO.

> Which one of the following C operators is right associative?

Officially, C doesn't really have either precedence or associativity
(though, again, I'll admit the point is pretty pedantic).

> According to the Standard C specification, what are the respective
> minimum sizes (in bytes) of the following three data types: short;
> int; and long?

None of the answers given is correct. With a large enough size of
byte, all of these could have a size (in bytes) of 1. You should
probably change "byte" to "octet", or perhaps phrase the answer in
terms of bits instead of bytes.

> penny = one nickel = five dime = ten quarter = twenty-five
> How is enum used to define the values of the American coins listed
> above?

Though it's not really related to C, I think the first line would
benefit from adding some punctuation (e.g., commas or semicolons)
between the items. I had to reread it a couple of times to be sure
exactly what you were asking.

As far as results go, Keith's right that simply seeing how others
have answered the questions isn't really helpful for questions that
have factually correct answers. Worse, it appears that your
tabulation of answers isn't working quite right anyway. For example:

Given: int var1;

You give the following:

Yes; it can be referenced through the extern specifier. 0 0%

The 0 is clearly incorrect, as that's the answer I had just given...

--
Later,
Jerry.