Another spinoza challenge

S

spinoza1111

As part of my effort to relearn C after all these years, I shall from
time to time take C programming tests. I shall take more than one to
avoid the silly debate that erupted here when some of the resident
thugs here did bad on a sparknotes C++ exam last year in response to
that challenge.

I shall take all tests closed book and without leaving the test Web
page, shown full screen. I shall work quickly.

On the first test I found at

http://irc.essex.ac.uk/www.iota-six.co.uk/c/a5_basic_quiz.asp

(an apparently jejune test) I got 86% (13/15). I do not know how
"good" it is.

Gentlemen, start your engines.

Resident C experts, thugs, goons, gangstas and byotches are also
welcome to submit their own tests.
 
S

spinoza1111

spinoza1111 said:



Neither do I, but if you (or anyone) would care to present the list of
questions (and, if it's multiple choice, the various answers for each
question) here in Usenet, it will not be difficult to tell you how
good the test is.

Click the link; you are fond of hiding things away and referring to
links, so sauce for your goose. The GUI makes getting the questions a
bit hard, since you have to answer each question before going to the
next question. So...you have to take the test, Richard.
 
L

luserXtrog

spinoza1111 said:



Neither do I, but if you (or anyone) would care to present the list of
questions (and, if it's multiple choice, the various answers for each
question) here in Usenet, it will not be difficult to tell you how
good the test is.

<snip>

I think the test is baloney. But I only got 12/15. It doesn't ever
tell you what it thinks the correct answers are. But it does injure
my vanity to achieve a lower score than spinny.
 
L

luserXtrog

I think the test is baloney. But I only got 12/15. It doesn't ever
tell you what it thinks the correct answers are. But it does injure
my vanity to achieve a lower score than spinny.

Upon adjusting my answers to discover the test's notions of the
right answers, some oddities emerged:
C is considered "high-level", not "low-level".
Computers do not understand C.
_MAX_POWER is considered a valid identifier.

I conclude that all my errors were in fact correct.
Therefore I am a genius. Super-duper blooper snooper.
 
S

spinoza1111

I think the test is baloney. But I only got 12/15. It doesn't ever
tell you what it thinks the correct answers are. But it does injure
my vanity to achieve a lower score than spinny.

Perhaps you scored lower because C is such a munged language and has
as a result many different argots, patoises, and dialects. Or maybe I
know more than you about almost everything.
 
F

Flash Gordon

luserXtrog said:
Upon adjusting my answers to discover the test's notions of the
right answers, some oddities emerged:
C is considered "high-level", not "low-level".

Not uncommon. Assembler is low level, and C is considerably higher.
Computers do not understand C.

True. That is why you need a compiler to compile it or an interpreter to
interpret it.
_MAX_POWER is considered a valid identifier.

That is more of an issue.
I conclude that all my errors were in fact correct.

Well, you are wrong.
Therefore I am a genius. Super-duper blooper snooper.

Well, most of the questions have sod all to do with ability to program
in C, and a number were just plain stupid. Knowing Dennis Ritchie as the
inventor does not help...

Also the test has not been updated for C99 even though the copyright is
2001-2003 (it asks for valid comment type and includes // as an
incorrect answer).

So most of the questions are correct, but it does not do any useful
testing of C knowledge or ability. The only one where it os not obvious
what the "correct" answer is would be the one asking for valid variable
names where they expect _MAX_POWER to be valid, which I got wrong
because I assumed they knew C better than that (it is reserved for the
implementation, so not valid in user code).
 
B

bartc

luserXtrog said:
I think the test is baloney. But I only got 12/15. It doesn't ever
tell you what it thinks the correct answers are. But it does injure
my vanity to achieve a lower score than spinny.

I thought I did badly but got 14/15. Don't know which one I got wrong.

But the test seems more for fun than anything else.
 
D

Dennis \(Icarus\)

Flash Gordon said:
Not uncommon. Assembler is low level, and C is considerably higher.


True. That is why you need a compiler to compile it or an interpreter to
interpret it.


That is more of an issue.


Well, you are wrong.


Well, most of the questions have sod all to do with ability to program in
C, and a number were just plain stupid. Knowing Dennis Ritchie as the
inventor does not help...

Also the test has not been updated for C99 even though the copyright is
2001-2003 (it asks for valid comment type and includes // as an incorrect
answer).

So most of the questions are correct, but it does not do any useful
testing of C knowledge or ability. The only one where it os not obvious
what the "correct" answer is would be the one asking for valid variable
names where they expect _MAX_POWER to be valid, which I got wrong because
I assumed they knew C better than that (it is reserved for the
implementation, so not valid in user code).

Is there a C compiler that will distinguish between an
implementation-defined identifier beginning with _ vs one that appearrs in
user code?

According to the language syntax, such identifers are valid. The spec does
say they're reserved, which basically means you should not define such an
identifier, but it is indeed valid.

Dennis
 
B

Beej Jorgensen

Richard Heathfield said:
If the test is baloney (which hasn't yet been conclusively
established, although what has been reported so far is not hopeful),
the score is irrelevant.

The test appears to be of the "quiz yourself on the material you just
read" nature. As such, I feel it's fine for its purpose, even if it's
not a professional comprehensive exam.

It does, however, contain a number of things that would make pedantic
CLCers squirm.

-Beej
 
F

Flash Gordon

Dennis said:
Is there a C compiler that will distinguish between an
implementation-defined identifier beginning with _ vs one that appearrs
in user code?

No idea, but there does not need to be one.
According to the language syntax, such identifers are valid. The spec
does say they're reserved, which basically means you should not define
such an identifier, but it is indeed valid.

That means it is syntactically valid, but not valid in user code as far
as the C standard is concerned. I.e. if you use it *anything* can
happen, the most likely things being it "working" if the implementation
does not use it or compilation failing if the implementation does define
it (most likely as a macro for providing a numeric value, based on the
name).

Note that the C standard does not define valid. Also note that it allows
for programs being compiled and run even if they include syntax (or
other) errors. So it all depends on how the reader of the test chooses
to define valid, and my definition excludes it.

It is certainly not reasonable to use it as one of the "valid
identifiers" in a test, because there are good arguments (even if they
do not convince everyone) that it is not valid.
 
C

Chris M. Thomasson

spinoza1111 said:
As part of my effort to relearn C after all these years, I shall from
time to time take C programming tests. I shall take more than one to
avoid the silly debate that erupted here when some of the resident
thugs here did bad on a sparknotes C++ exam last year in response to
that challenge.

I shall take all tests closed book and without leaving the test Web
page, shown full screen. I shall work quickly.

On the first test I found at

http://irc.essex.ac.uk/www.iota-six.co.uk/c/a5_basic_quiz.asp

(an apparently jejune test) I got 86% (13/15). I do not know how
"good" it is.

Gentlemen, start your engines.

Resident C experts, thugs, goons, gangstas and byotches are also
welcome to submit their own tests.

I got 14/15 because I asserted that C is a low-level programming language.
For some reason, I am still going to make that assertion. IMVHO, C is NOT a
high-level programming language. Oh well, 14/15 is not that bad!

;^)
 
C

Chris M. Thomasson

bartc said:
I thought I did badly but got 14/15. Don't know which one I got wrong.

But the test seems more for fun than anything else.

Did you happen to answer that C was a low-level programming language? That's
the question I got wrong.
 
B

bartc

Chris M. Thomasson said:
Did you happen to answer that C was a low-level programming language?
That's the question I got wrong.

Can't remember, I might have chosen mid-level language, which would make
that my wrong question.

If that question had come later, I'd have known more about their expertise
level and might have deduced that mid-level language was supposed to be a
silly answer rather than a plausible one.
 
D

Dennis \(Icarus\)

Flash Gordon said:
No idea, but there does not need to be one.


That means it is syntactically valid, but not valid in user code as far as
the C standard is concerned. I.e. if you use it *anything* can happen, the
most likely things being it "working" if the implementation does not use
it or compilation failing if the implementation does define it (most
likely as a macro for providing a numeric value, based on the name).

Sure - just like any other symbol conflict.
Note that the C standard does not define valid. Also note that it allows
for programs being compiled and run even if they include syntax (or other)
errors. So it all depends on how the reader of the test chooses to define
valid, and my definition excludes it.

It is certainly not reasonable to use it as one of the "valid identifiers"
in a test, because there are good arguments (even if they do not convince
everyone) that it is not valid.

But it's a valid identifier for the implementation to use?

Dennis
 
F

Flash Gordon

Dennis said:
Sure - just like any other symbol conflict.

Well, something which can cause a failure to compile doesn't sound very
valid to me...
But it's a valid identifier for the implementation to use?

Yes, but the test was for people writing application code, not for
people writing an implementation.
 
C

Chris M. Thomasson

Malcolm McLean said:
The first question is

is C a ??? programming language. Options are

low-level
stupid
dumb
high-level
mid-level

The answer they are probably look for is low level.

I got 14/15 because I answered low-level. Oh well, shi% happens.
 
L

luserXtrog

luserXtrog wrote:

True. That is why you need a compiler to compile it or an interpreter to
interpret it.

I kinda consider compilers part of "computers". Forest::Tree.
If computers didn't understand C, we would all seriously be
wasting our time.
That is more of an issue.


Well, you are wrong.

:) I tried to be audaciously ostentatious below to
underscore the ironic overstatement above.
Well, most of the questions have sod all to do with ability to program
in C, and a number were just plain stupid. Knowing Dennis Ritchie as the
inventor does not help...
<trim>
 
C

chad

As part of my effort to relearn C after all these years, I shall from
time to time take C programming tests. I shall take more than one to
avoid the silly debate that erupted here when some of the resident
thugs here did bad on a sparknotes C++ exam last year in response to
that challenge.

I shall take all tests closed book and without leaving the test Web
page, shown full screen. I shall work quickly.

On the first test I found at

http://irc.essex.ac.uk/www.iota-six.co.uk/c/a5_basic_quiz.asp

(an apparently jejune test) I got 86% (13/15). I do not know how
"good" it is.

Gentlemen, start your engines.

Resident C experts, thugs, goons, gangstas and byotches are also
welcome to submit their own tests.


I scored a 12/15. Does this mean that I'm not one of the cool kids?
 
D

Dennis \(Icarus\)

Flash Gordon said:
Well, something which can cause a failure to compile doesn't sound very
valid to me...

In that case, no identifier is valid, because each oen you define can cause
a conflict it it's been defined elsewhere.
Yes, but the test was for people writing application code, not for people
writing an implementation.

People writing app code can use implementation-defined symbols, and should
recognize them as valid.

All it asked was what's a valid variable name - an implementation-defined
variable in a header would be valid.
It'd be unusual, but valid.

Dennnis
 
F

Flash Gordon

Dennis said:
In that case, no identifier is valid, because each oen you define can
cause a conflict it it's been defined elsewhere.

That is obviously being ridiculous. However, an implementation including
#define _MAX_POWER 37
is perfectly reasonably and causes compilation failure.
People writing app code can use implementation-defined symbols, and
should recognize them as valid.

All it asked was what's a valid variable name - an
implementation-defined variable in a header would be valid.
It'd be unusual, but valid.

An implementation could define behaviour for this post making it valid
C, so by your definition EVERY possible file is valid C since some
implementation could define behaviour for it.

In any case, if a C compiler specifies behaviour for some specific
construct which the C standard doesn't, it is valid for the specific
compiler, not valid in general, making it perfectly reasonable to say it
is not valid (or to not include it in the list of valid identifiers).
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top