Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum



spinoza1111 said:

I have an idea for reducing the cyberbullying at this ng which I've
also used at humanities.lit.authors.shakespeare.

It is "The Spinoza Challenge".

I will take a test on a programming topic without special preparation
and closed book, and report my score, along with information as to my
overall familiarity with the tested platform, language or topic.

My first Spinoza Challenge: beat my score: I just took the C++ test
that is available on Spark Notes at
http://www.sparknotes.com/cs/c++fundamentals/review/quiz.html and
received 76%.

I have no particular comment to make on question 1, although I wouldn't
have worded the question like that.

Question 2 is unfortunate, since it has two correct answers; although it's
obvious which one is wanted, another of the answers is perfectly
defensible. Neither is exclusively correct.

Question 3 is trivial.

Question 4 is badly worded but one can get the gist easily enough. Strictly
speaking, the assignment operator - *provided that it is not overloaded to
do something else* - evaluates the right hand operand and copies the value
into the object specified by the left hand operand.

Question 5 is broken. None of the specified types guarantees the necessary
precision for dealing with twenty decimal digits. The long double type
only guarantees ten. One could reasonably argue that any of the integer
types mentioned gives an adequate basis for developing a bignum library
that could give the required precision.

Question 6 is broken. None of the supplied answers gives the required
output, which is:

a c b d

(A) will give a\t\nb\td
(B) will give some output dependent on the (unsupplied) values of the
objects given in the expression.
(C) will give acb\nd
(D) will give ab\nc\td

In the cases of A, C, and D, the backslashes shown here do not introduce
escape sequences (which would in any case break their conformance to the
requirement), but literally part of the output, as they are themselves
escaped.

Question 7 is trivial.

Question 8 is broken. All of the suggested answers except A exhibit
undefined behviour, and answer A modifies the value of x. There is no
correct answer.

Question 9 is trivial.

Question 10 fails to account for pointer comparison, but is otherwise
trivial.

Questions 11, 12, and 13 are trivial.

Question 14 is ambiguous - it depends on whether you consider 'between' to
be inclusive. I don't, so I might disagree with the marker over which
answer should be considered correct.

Question 15 is trivial.

Question 16 is trivial if you discount the possibility that the break
appears inside a switch.

Questions 17 and 18 are trivial, but 18 is very badly worded.

Questions 19, 20, and 21 are trivial.

Question 22 is incorrect. sqrt is declared in <math.h> but only a complete
bozo would define it there.

Questions 23-27 are trivial.

Question 28 has no good answer. There's no reason why you can't write a
linked list class (although there's no point, because there's one in the
STL). Nor is there any reason why you couldn't use structs to implement a
linked list. Nor is there any reason why you can't construct a linked list
that can hold only a single type. Nor is there any point in constructing a
linked list that can only have a fixed number of elements.

Question 29 has no correct answer. Arrays don't hold types. They *have*
types, but they are aggregate types that can store multiple *objects* of a
given type. If we agree that that's kinda what the guy meant only he
didn't say it very well, we must discount (A) as being incorrect (because
they can hold complicated types such as user-defined types). We must also
discount (B) because arrays can't hold function types (although they /can/
hold function pointer types). And we must discount (C) for the same reason
as (B).

Questions 30 and 31 are trivial.

Question 32 has no correct answer.

Questions 33-43 are trivial.

Question 44 has no clearly correct answer. (A) is wrong because it doesn't
access the base class function. (B) is wrong because it uses a class name
in an object context. (C) is wrong unless the code exists within the class
of which the function is a member.

Questions 45-47 are trivial.

Questions 48-49 seem to use the word "composition" in a way I'm not
familiar with. I think of the term as applying to the moving of a
subexpression evaluation into an object that stores the subexpression to
make subsequent evaluation of the whole expression simpler and quicker. It
is not obvious that the suggested answers have anything to do with this!
This may simply be because I'm not as up on C++ as the author of the quiz.
Given the brokenness of the rest of it, however, I do not find that
possibility to be terribly likely.

Question 50 is trivial.

I didn't give answers to the ones I thought had no correct answer. I scored
80% (i.e. 40 out of 50).

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -http://www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999
.



Relevant Pages

  • Re: C89, size_t, and long
    ... ISO type and the idea behind it is broken; the only valid reason to have ... theoretical possibility of brokenness when you already know that you ... stddef.h in library headers due to bugs in C implementations ... solely on guarantees made by the C standard. ...
    (comp.lang.c)
  • Re: C89, size_t, and long
    ... ISO type and the idea behind it is broken; the only valid reason to have ... theoretical possibility of brokenness when you already know that you ... stddef.h in library headers due to bugs in C implementations ...
    (comp.lang.c)
  • Re: 500ppm - is it too small?
    ... this brokenness but I think it would be easier and cheaper to fix or ... And that was a random figure chosen for no good reason, ... ntp is to take broken hardware and make it deliver the time accurately. ...
    (comp.protocols.time.ntp)
  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... overall familiarity with the tested platform, language or topic. ... The decrement happens BEFORE the assignment (simple ... Question 16 is trivial if you discount the possibility that the break ... Nor is there any reason why you couldn't use structs to implement a ...
    (comp.programming)
  • Re: Extreme!!! Special timelimited competive upgrade offer
    ... I read his offer of a 50% discount for users of his opposition's ... 'small' developers, the home developers, the one person consultant company etc.. ... unless there is a specific technical or other reason to ... probably be unwisely spend time porting any large projects just for the sake of the port. ...
    (borland.public.delphi.thirdpartytools.general)