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



On Mon, 31 Dec 2007 08:00:46 -0600, Richard Heathfield wrote
(in article <1b6dnZqakImpaOXanZ2dnUVZ8q-rnZ2d@xxxxxx>):

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.

I stared at that one for a bit longer than 30 seconds nilges wanted to
see, and probably longer than most of the others combined, and I
finally punted and picked one that I guessed was most likely to be what
the marker thought was the right answer, despite the lack of one I was
happy with. I don't remember which I guessed now, or if I got it
right. *shrug*

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.

I had a good feel for what was likely to be UB in C++ if I fell into
using C as a comparison for some of these, but not being anything like
a language lawyer with C++, and knowing that the languages differ, but
in many ways I am not directly familiar, I took a swag on this one, I
believe I got it "right" in terms of marker, but don't remember for
sure what I put down. By this point I was already kind of "going with
it", and not caring too much anymore.

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

Agreed. But I guessed by this point that there was a bit of bozo at
work and picked the likely "correct" answer in light of that, and
concluded so correctly.

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.

Yes, again I tried to imagine what someone would think would be an
authoritative answer here and got it.

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.

Here I couldn't find a satisfactory answer either, so I guessed, and
iirc, got this one wrong.


--
Randy Howard (2reply remove FOOBAR)
"The power of accurate observation is called cynicism by those
who have not got it." - George Bernard Shaw





.



Relevant Pages

  • Re: Brian Kernighan, maybe Im not worthy, maybe Im scum
    ... a language lawyer with C++, and knowing that the languages differ, but ... bozo would define it there. ... Nor is there any reason why you can't construct a linked list ... access the base class function. ...
    (comp.programming)
  • Re: Tournament sadness
    ... RazzO wrote: ... > The Bozo needs to consider at what point of the tournament you are in as ... consider calling an all-in from one opponent with pocket Aces reckless. ... Still I'd try to find a reason to believe." ...
    (rec.gambling.poker)
  • Re: Redirecting my Documents folder, any disadvantages ?
    ... Just the opposite, bozo. ... You're in such a hurry to find a reason to add a URL to your site that ...
    (microsoft.public.windows.vista.general)
  • Re: Installed a TC supercharger today
    ... > And you wasted both your TIME and your MONEY for WHAT reason? ... Bozo ... Prev by Date: ...
    (alt.autos.toyota)