Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- From: jellybean stonerfish <stonerfish@xxxxxxxxxxxxx>
- Date: Thu, 03 Jan 2008 08:34:14 GMT
On Wed, 02 Jan 2008 21:15:24 +0000, Richard Heathfield wrote:
jellybean stonerfish said:
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 will disagree with you here. Digging out my copy of the c++
programming language on page 125, stroustrup says that y=++x is
equivalent to y=(x+1)
Yes, but the suggested answer isn't y=++x, but x=++x (or some trivial
variation thereof - I don't have the original to hand). This violates the
requirement that a value shall not be modified more than once between
sequence points.
x = --x + 1; was the answer they wanted. Seems that x would be
decremented then one added to that value and then assign that value to x.
I guess I need to read up, because I have no idea what you folks are
talking about when you say "sequence points"
I still don't quite understand, is
there a difference between 'logical values' and 'boolean'?
<shrug> The phrase "logical value" doesn't appear in the language
definition. Boolean values are either true or false.
Maybe not in the language definition, but I use boolean to mean logical
value. Oh, never mind...
I don't understand your statement. Why is answer 'c' (can hold any
type of data ) not a good answer?
Because it's trivial to write a linked list that can hold only a single
type of data. (Yes, it's also trivial to write a linked list that can
hold any type of data.)
It appears we agree but state things differently.
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.
Base_class is an object of the base class?
If so, it's a lousy name, wouldn't you agree?
Yes.
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.
I believe 'composition' in this context means to put together parts to
make a bigger object, so I picked 'c', the correct answer.
The term is "aggregation", and struct types (and arrays, which do a
similar trick) are called "aggregate types". Composition is something
else (see Stroustrup, which explains it reasonably well-ish).
I didn't realize that the word is actually in the index.
I read the couple of paragraphs about composition. I don't have it
fully, but enough to see that the test's answers were incorrect.
I will re-read the full chapter on namespaces when it is not so late. I
have a strange problem in that as much as I love to read programming
books, they have a tendency to put me to sleep.
I was begining to think I totally wasted my time even taking the
test, but I did learn a thing or two. Maybe not from the test itself,
but it was a catalyst.
stonerfish
.
- Follow-Ups:
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- From: spinoza1111
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- From: Richard Heathfield
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- References:
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- From: jellybean stonerfish
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- From: Richard Heathfield
- Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- Prev by Date: Re: Oversight and Programmer productivity
- Next by Date: Array average algorithms
- Previous by thread: Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- Next by thread: Re: Brian Kernighan, maybe I'm not worthy, maybe I'm scum
- Index(es):