Matt wrote:
[ ... ]
I have not yet extensively researched this yet, but as an example, I
thought this test looked pretty good:
http://expertrating.com/c++test.asp
It's not particularly great. I probably shouldn't have wasted my money
on it, but I decided to look at it, and noticed questions like this:
-> Question:
-> State which of the following are true:
->
-> a. You can use a goto statement to jump into a __try statement block
-> or a __finally statement block
-> b. You can nest an exception handler or termination handler inside a
-> __finally block
-> c. You can use a goto statement to jump out of a __try statement
-> block or a __finally statement block
-> d. All of the above are false
This was supposed to be a test about C++, wasn't it? Where did this
nonsense about __try and __finally come from? WRT to C++, even D isn't
really correct, because none of them really qualifies as truly true or
false, but merely irrelevant. Even if the question were rephrased to
deal with C++, it's still downright stupid anyway! Given a limited
number of questions, which subject should be included: goto or (for
example) partial specialization?
As another example:
-> Consider the sample code given below and answer the question:
->
-> class A{
-> public:
-> A() {}
-> ~A(){ cout << "in destructor" << endl;}
-> };
->
-> void main(){
-> A a;
-> a.~A();
-> }
->
-> How many times will the destructor be called in the above code?
-> a. 0
-> b. 1
-> c. 2
-> d. There is an error because destructors cannot be called directly
I suppose they probably want C -- but they're wrong. The correct answer
is that the code has undefined behavior. Nothing more and nothing less
-- any arbitrarily chosen result is equally correct for this input. D
is wrong, because explicit dtor invocation is allowed, and sometimes
even useful (usually in conjunction with placement new).
Yet another question asks:
-> Base class members are made public for a derived class and private
-> for rest of the program by:
Well, there simply is no such thing -- presumably they're trying to
refer to "protected", but protected doesn't make anything public or
private. Rather, it makes the it accessible or inaccessible.
I won't belabor the point, though this certainly isn't a complete list
of even the obvious errors. The bottom line is that while I've seen
worse, this test is still sadly inaccurate.
I'll admit that writing a good test (i.e. selecting questions whose
answers really _mean_ something) is difficult. If you settle for
testing stupid things, writing the test should be easy, but they've
managed to get even that wrong! Oh well, I guess I'll get off my
soapbox and return you to your regularly scheduled flaming...