473,385 Members | 1,347 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Employer looking 4 online C++ aptitude tests; recommendations?

Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1

-Matt
--
Remove the "downwithspammers-" text to email me.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #1
51 7835
Matt wrote:
Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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
I find it a bit offensive to have a candidate pay.

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1


I just went through the process myself in creating a bunch of questions.

Nothing beats creating the questions that you feel work for you.

What are important skills for this position ?
Jul 22 '05 #2

my opinion on this is that , if you are looking for the best staff,
a simple C/C++ test is not enough. You should create your own
based on your own requirements / what you think is important for
a programmer to know.

The best test I was ever given was to be sat in a room in front of an
(unfamiliar) C compiler and given an hour to write a program to
read in a proprietary file containing graphics shapes and draw it to
the screen. I did'nt quite finish the exercise, but it showed them
what they needed to know. Could I code, and what was approach to
solving the problem re: design.

I consider myself an intermediate C++ programmer, I still get caught
out by syntactic sugar , the sort of thing a C++ tests are designed around
but I don't consider myself any less a programmer for it.

Hope this helps.

Mark
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:8a********************************@4ax.com...
Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1

-Matt
--
Remove the "downwithspammers-" text to email me.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #3

my opinion on this is that , if you are looking for the best staff,
a simple C/C++ test is not enough. You should create your own
based on your own requirements / what you think is important for
a programmer to know.

The best test I was ever given was to be sat in a room in front of an
(unfamiliar) C compiler and given an hour to write a program to
read in a proprietary file containing graphics shapes and draw it to
the screen. I did'nt quite finish the exercise, but it showed them
what they needed to know. Could I code, and what was approach to
solving the problem re: design.

I consider myself an intermediate C++ programmer, I still get caught
out by syntactic sugar , the sort of thing a C++ tests are designed around
but I don't consider myself any less a programmer for it.

Hope this helps.

Mark

"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:8a********************************@4ax.com...
Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1


[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #4
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...

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #5
Thanks all for the feedback. I'm specifically looking for
alternatives to expertrating.com; can anyone offer suggestions?

Here's my current list:

http://brainbench.com
http://teckcheck.com
http://proveit.com
http://qwiz.com
http://expertrating.com

To follow up previous points:

We do not plan to charge candidates for the tests; the fact that
expertrating.com does so is unfortunate. I would look for a way for
them to charge me instead when administering the test, or reimburse
the candidate.

We are a startup company, and I play the role of software-development
manager. I have heavy development and systems-engineering background,
as well as requirements development, marketing, program-management,
etc. Unfortunately, my immediately-previous jobs were lean on the
software and heavy on the marketing/training, and my swdev skills are
quite rusty, including my C++ knowledge, tools, and syntax. I think
my requirements and design skills are quite good. I'm looking for
someone to fill a "C++ language-and-usage expert" hole to start. More
positions to fill later as we get up to speed.

We have developed other test material to cover general logic and other
swdev skills. Now I want material to cover C++ specifically. I like
an in-room test as well, but I also want something I can administer
prior to a face-to-face interview. To reiterate, I'm also looking for
a C++ language expert, for while I will hopefully become something
akin to that in the coming months, I don't have to have to page
through manuals to learn everything in the STL by myself, etc etc.

Thanks for any help,
-Matt
On 18 Jan 2005 18:18:16 -0500, Matt
<ma**@downwithspammers-mengland.net> wrote:
Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1

-Matt


--
Remove the "downwithspammers-" text to email me.
Jul 22 '05 #6
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:tq********************************@4ax.com...
Thanks all for the feedback. I'm specifically looking for
alternatives to expertrating.com; can anyone offer suggestions?


My concern with mechanized tests of any kind is that they don't really tell
you much beyond how good the candidate is at taking tests. Moreover, the
knowledge contained in such tests is often irrelevant to actual job
performance.

Another problem with such tests is that the alternatives offered often
exclude the correct answer, which is: "I don't know, because I'd never write
code like that, and if I ever encountered it, I know where to look it up."

If I were interviewing someone for a programmer job, I think I would start
with three questions:

1) Tell me about a piece of technical work you did that you're
particularly proud of, and explain what you did that makes you proud.

2) Tell me about a particularly bad design decision you made, and
explain what you learned from it.

3) Make up an interview question, answer it, and explain why you think
it's a good question.

My guess is that if someone's trying to snow you with inadequate
qualifications, you'll know it for sure before the candidate is done with
the first question.
Jul 22 '05 #7
Matt wrote:
Thanks all for the feedback. I'm specifically looking for
alternatives to expertrating.com; can anyone offer suggestions?

Here's my current list:

http://brainbench.com
http://teckcheck.com
http://proveit.com
http://qwiz.com
http://expertrating.com

To follow up previous points:

We do not plan to charge candidates for the tests; the fact that
expertrating.com does so is unfortunate. I would look for a way for
them to charge me instead when administering the test, or reimburse
the candidate.

We are a startup company, and I play the role of software-development
manager. I have heavy development and systems-engineering background,
as well as requirements development, marketing, program-management,
etc. Unfortunately, my immediately-previous jobs were lean on the
software and heavy on the marketing/training, and my swdev skills are
quite rusty, including my C++ knowledge, tools, and syntax. I think
my requirements and design skills are quite good. I'm looking for
someone to fill a "C++ language-and-usage expert" hole to start. More
positions to fill later as we get up to speed.

We have developed other test material to cover general logic and other
swdev skills. Now I want material to cover C++ specifically. I like
an in-room test as well, but I also want something I can administer
prior to a face-to-face interview. To reiterate, I'm also looking for
a C++ language expert, for while I will hopefully become something
akin to that in the coming months,
I remember once thinking that. C++ is a huge language. A few months
won't cut it. I still run into grey areas and I also find issues where
the standard itself (or implementations) are ambiguous.

There are multiple paradigms for programming in C++. You can find
yourself with a very compentant language guy with all the wrong experience.

C++ as it stands is just a tool. You need to have much more knowledge
about how you would layer on top of C++ for your particular problem. I
suggest that you can find 5 very qualified candidates with 5 very
different opinions. How are you going to choose the right one ?

I don't have to have to page through manuals to learn everything in the STL by myself, etc etc.

Jul 22 '05 #8
To reiterate:

A C++ "language" test is not the only test and/or interviewing
process/stage/gate we are using. It's simply one among many.

Questions like these:
1) Tell me about a piece of technical work you did that you're
particularly proud of, and explain what you did that makes you proud.

2) Tell me about a particularly bad design decision you made, and
explain what you learned from it.

3) Make up an interview question, answer it, and explain why you think
it's a good question.


are good ones and are already part of an existing, pre-interview
qualification test that we are currently using. Further, we probe
much more background during phone and face-to-face interviews (eg,
things that cover more of the nature of our business and technology
focus).

Now I want more nitty-gritty C++ questions to gauge their true C++
experience and capability. I don't want to hire what seems to be a
capable candidate and then find out I can run C++ circles around said
candidate. Please note: this will be one data point among several to
be considered for application qualition; it will be far from the only
thing.

This still seems to me like a valid endeavor to me; maybe I'll learn
otherwise in the future. Until then, I'd be interested to know if
anyone considers *any* online tests helpful for *any* reason. What
I'm hearing thus far is: "you should consider using other
interviewing techniques instead." From what I can tell, we are using
some of these techniques already...and I'd like to investigate
more-technical test administration in some fashion or another, whether
I have to write these things or not. I've taken them before as an
applicant, and I'm very glad said employers issue them; I felt these
past tests that I've taken helped separate the "wheat from the chaff"
rather quickly.

Regards,
-Matt
--
Remove the "downwithspammers-" text to email me.
Jul 22 '05 #9
On Wed, 18 Jan 2005, Matt wrote:

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.


I'm a programmer (C, C++, and LISP) looking for work, and I refuse to take
tests. After my last job I took the time to write a package and
publish it. I use this to demonstrate my ability to program
in C++. (No one seems to care about C anymore, except for embedded
applications, and nobody seems to care about LISP anymore at all, more's
the pity.)

The problem is, there are things that are easy to test, but have no value
for actual programming in real life. For example, I haven't memorized the
rules governing the priority of operators. I know some rules just by
using operators all the time, but the compiler doesn't care if I put in
parentheses if I'm unsure. It also makes my code more readable for people
who haven't memorized the rules, either.

A couple of tests potential employers gave me for C involved
expansion of preprocessor macros.
Using inscrutable preprocessor macro constructions in programs is about
the most stupid programming technique I can think of. But it's easy to
test. It's also an easy way to make someone fall on his or her face,
which is what happened.

I don't carry the language definitions of C and C++ or the calling
conventions of all of the functions in the STL around in my
head. I don't think it would make me a better programmer if I did.
I know the things I use often and I can look the others up.
If you ask me about something I don't use a lot, it's quite possible I
won't know the answer.

I applied for a job recently and was asked to learn how to use that
company's software and write a short program for some purpose! I think
I can use my time better by applying to other companies. By the same
token, I never fill out companies' "special on-line application forms".
I hope I find a company that's willing to take the trouble to
evaluate my work instead of making a decision based on a somewhat
arbitrary test. And any test will be somewhat arbitrary.

Laurence Finston
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #10
> -> 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?
I don't understand this:

can you do:

goto a;
__try
{

}
__catch(...)
{
a:
goto c;
}
__finally
{
__try
{
}
__catch(...)
{
}
goto c;
}

c:
;
-> class A{
-> public:
-> A() {}
-> ~A(){ cout << "in destructor" << endl;}
-> };
->
-> void main(){
-> A a;
-> a.~A();
-> } I suppose they probably want C -- but they're wrong. The correct
answer
is that the code has undefined behavior.


Why? Is it not allowed to call the d'tor explicitly for an object not
created with 'new'?
But I agree, stupid tests questioning C++ do not help getting you a
good employee. Main intererst should be: how does he/she approach new
problems, what's the coding style, what if something does not work?

I'd let them hand in a nice 100 line source project and explain what
it does. From a code listing of someone you can get a very good
implression of what he/she's like.

Maybe you'd better make sure you're watching while the code get's
written, so there's no danger of cheating.

-Gernot

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #11
Why do you need an online aptitude test?

Couldn't you design some interview questions that are a much better at
detecting the skillset you are looking for in an employee?
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #12
KCs
I think that it isn't very fortunate to hire programmers testing their
knowledge of a specific language. A better approach is to test their
algorithmic skills, their thinking. A language is just a tool and it's
usage can be learned quite fast.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #13
In article <11**********************@f14g2000cwb.googlegroups .com>,
Jerry Coffin <jc*****@taeus.com> writes
-> 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.


It has undefined behaviour before it tries to call a dtor (it has the
wrong return type for main(). This kind of thing says far more about the
testers than it does about the tested. If the examples you give are in
anyway typical I would want my money back because they claim that every
question has at least one correct answer, that claim is demonstrably
false.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #14
Gernot Frisch wrote:
I don't understand this: can you do:
goto a; __try {...


C++ does not contain constructs named __try, __catch, or __finally,
so it makes no sense for a claimed C++ test to ask about them.
-> void main(){ A a; a.~A(); }

Why? Is it not allowed to call the d'tor explicitly for an object not
created with 'new'?


It is undefined behavior to cause a d'tor to be called more than once
on an object. A program which executes undefined behavior, as this one
does, has no required behavior according to the standard. Therefore none
of the choices is correct.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #15
On Tue, 18 Jan 2005 18:18:16 -0500, Matt wrote:
I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.


brainBench seems quite good to me.
It draws from a very large database, making it harder
for agents to cheat, and although it is multiple-choice
the choices have subtle differences. Also the responses
have a time limit.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #16
Jerry Coffin wrote:
-> 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.
Actually, d) is correct, IMHO -- If there is no such thing
as a __try statement block in C++, then a statement that
says you can do whatever thing into a __try statement block
is false: it is false because there is no such thing as
a __try block, and therefore NO, you can NOT use a goto to
jump into a __try block.

(same reasoning applies to the other two)

The sad reality is, I would bet one year's salary that
according to them, d) is NOT the correct answer... :-(
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?
150% agree with that!
-> 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.


Not to mention that beautiful void main()...

Cheers,

Carlos
--

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #17
Hi,

Matt wrote:
I'm curious if anyone can offer any other recommendations?


I may be biased, but this served me well (I'm on the other side):

http://www.brainbench.com/

(click around patiently to dig out the C++ test)
As for the C++ test itself, it is rather focused on syntax issues
instead of idioms and techniques, so don't rely on a *single* test to
select your candidates. If you can combine such tests with *other* ways
of assessing candidates, then those tests can certainly help you.

--
Maciej Sobczak : http://www.msobczak.com/
Programming : http://www.msobczak.com/prog/

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #18
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:8a********************************@4ax.com...
I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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
I've never tried this one. An alternative I am familiar with is
available at www.brainbench.com.
I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?
I cannot rate the expertrating test, so I can't compare. Personally,
I'd probably not be fully satisfied with the coverage or quality
of either test.
Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1


I agree, but keep in mind that these multiple-choice online tests
have a limited scope. They can test for knowledge of the language,
but not coding quality, proficiency, etc. I'd say that being able
to pass the test can be a necessary condition (i.e. for screening),
but not sufficient (to my hiring standards).

As part of the interview process, I will go further and give an actual
coding assignment. A company I worked for had a standardized assignments,
asking candidates to maintain and evolve an initial program through
multiple iterations of requirements. When properly reviewed by a
competent senior developer, I find that the result of such a test will
give you much better insight -- and feel less deprecatory to the candidate.

I hope this helps,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com
Full disclosure: I'm not affiliated with Brainbench other than for
having free access to their tests and online materials in exchange of
reviewing some of their test questions and posting this occasional link.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #19
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:2s********************************@4ax.com...
To reiterate:

A C++ "language" test is not the only test and/or interviewing
process/stage/gate we are using. It's simply one among many.

<<big snip>>
As I've said here before, you are opening yourself up to lawsuit from an
alert candidate. If the candidate can show that he/she did well on the
written exam and that the exam is not predictive of performance, not hiring
that candidate would (allegedly) show a bias in not hiring. The argument
goes that if you use a test and the candidate passes that test, then if you
don't hire it's because of some other determination. Why bother using the
test?

On the other hand, if the candidate fails the test (whatever that means) you
have to prove that everyone who works there can pass the test, and the test
asks questions that are predictive of successful work at your place. This is
very hard to do. You might start by seeing if you can pass the test.

What can be done is to administer testing after hiring to determine
experience and/or training that might need to be given. This should be
presented before hiring as a condition of employment, however.

Besides which, and more to the point, your questions are (so far) flawed
and/or meaningless. Predictive exams are hard to come by, and most on-line
quizes are pinpoint-limited to a very narrow range of syntax and language
topices --- hardly predictive of performance. I'd recommend you give up the
idea of a test and stick with (admitedly) subjective determination, stated
this way: the candidate appears to have the experience based on resume and
references and an attitude which fits our way of operating. A trial
employment will determine if the candidate can do the job within the normal
range of expertise we require. Then you conditionally hire for 30 days.

Sorry to sound so negative, but I've been down this road for almost 44
years. (My first experience was with the Programmer's Apptitude Test given
by IBM, in 1961). It still bothers me.
--
Gary
Jul 22 '05 #20
Hello Ivan,

I very much agree with your comments below.
As part of the interview process, I will go further and give an actual
coding assignment. A company I worked for had a standardized assignments,
asking candidates to maintain and evolve an initial program through
multiple iterations of requirements.


I find this in particular to be an excellent idea. Unfortunately, my
current environment (the very early stages of a startup company) is
prohibiting me from spending much time on test development. I may
attempt to develop and use such a mechanism in the future.

Alternatively, if anyone can refer me to existing, already-developed
mechanisms like this one (the changing-requirements stuff is
particularly useful), I would love to see it.

I suppose I could draw from past projects (...but I can't find them
anywhere...I did my C++ work a *long* time ago) or look through a
couple of my favorite books...although I'd be concerned with
plagiarism for the latter.

-Matt
--
Remove the "downwithspammers-" text to email me.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #21
Jerry Coffin wrote:
[ranting about the tests removed]

Thanks for sharing your experience: I had scheduled taking the test
later today just to see how it compares to Brainbench. I made a C++
test at Brainbench a few years ago and it was similar crap: it
tested MSVC++ specifics (the '__try' and '__finally' look like
particular extensions to me), had multiple choices questions with
the right answer being absent, etc. I managed to get a rating as
"master" anyway (and I was distrubed twice by phone calls, too...).
It seems that this site is similar crap.
--
<mailto:di***********@yahoo.com> <http://www.dietmar-kuehl.de/>
<http://www.contendix.com> - Software Development & Consulting
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #22
"Gary Labowitz" <gl*******@comcast.net> wrote in message
news:74********************@comcast.com...
As I've said here before, you are opening yourself up to lawsuit from an
alert candidate. If the candidate can show that he/she did well on the
written exam and that the exam is not predictive of performance, not
hiring
that candidate would (allegedly) show a bias in not hiring. The argument
goes that if you use a test and the candidate passes that test, then if
you
don't hire it's because of some other determination. Why bother using the
test? IANAL of course, but I wouldn't take this as realistic legal advice.
Yes there are hiring caveats (avoiding sensitive topics, and ensuring
the fairness of the process), but the above is total FUD in my opinion.
Besides which, and more to the point, your questions are (so far) flawed
and/or meaningless. Predictive exams are hard to come by, and most on-line
quizes are pinpoint-limited to a very narrow range of syntax and language
topices --- hardly predictive of performance. I'd recommend you give up
the
idea of a test and stick with (admitedly) subjective determination, stated
this way: the candidate appears to have the experience based on resume and
references and an attitude which fits our way of operating. A trial
employment will determine if the candidate can do the job within the
normal
range of expertise we require. Then you conditionally hire for 30 days. This is incredibly expensive! Plus someone you lay-off after 30 days
is much more likely to sue you for dicrimination or whatever other motive...
Sorry to sound so negative, but I've been down this road for almost 44
years. (My first experience was with the Programmer's Apptitude Test
given by IBM, in 1961). It still bothers me.

Screening tests are needed by large corporations that may receive
thousands of applications for a job opening. You can't hire them all
for 30 days based on a résumé and a nice interview chat!

Yes, tests are always flawed and biased. But by Bayesian logic, they
do help you get a vague opinion of someone's capabilities.

Lab or imaging exams made by your physician have flaws as well, but
in most cases they are much cheaper and safer than starting surgery
right away to see what is going on!
Kind regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Jul 22 '05 #23
KCs wrote:
I think that it isn't very fortunate to hire programmers testing their knowledge of a specific language. A better approach is to test their
algorithmic skills, their thinking. A language is just a tool and it's usage can be learned quite fast.


Raw intelligence is of no use if it is not accompanied with knowledge.
I have seen many people claiming to be experts in C++ and having zero
knowledge of STL. Such people would reinvent the wheel again and again,
programming their own linked lists, ... - and they would do it damned
good and in relatively short time, but would you like to maintain that
many implementations?

Of course you do not need to know all constructors from STL, but you
should now that something like this exists and you should be able to
find it in manual or in TC++PL in matter of seconds. But you must have
an overview of both the C and C++ standard library.

I use following 4 points in interviews:

1) Fill one or both tests from
http://www.cpp-home.com/index/tiki-list_quizzes.php (after site upgrade
there something wrong with the tests)
2) Go through the test(s) and discuss the mistakes or good answers
which you know are difficult.
3) Unnamed C function of 10 lines. Give it correct name, tell me what
it does and show me how would you do it in your favorite language.
4) Optimize 12 lines long C function with known functionality.
Reference Manual can be used.

The points 3 and 4 are because of our legacy C code we have to
maintain. Of course the most important is the point 2 and if possible I
would skip the part 1 :-). If someone fails with operator precedence
question and tells me that he prefers to use more parenthesis, than he
is my man. The test can even be used for people who do not know the
language. You ask them how would they do it in their favorite language.

Ondrej

---
Family Homepage: http://brablc.com
Bookmark Server: http://sitebar.org (GPL)
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #24

Matt wrote:
Hello,

I'm a hiring C++ developer employer looking for existing, online C++
aptitude tests.

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

I'm curious if anyone can offer any other recommendations? If so,
could you please offer your experience with your recommended resource
and why you recommend them...or might recommend others?

Fyi, My philosophy falls in line with this post:

http://groups-beta.google.com/group/...40d9074af466c1
-Matt
--


I have to agree with several other posters who see little value in such
aptitude tests.

Instead, the approach that I have used in evaluating developer
candidates is to get them in a room with a white board and a couple of
other developers and ask the candidate to describe and explain a past
project of their choosing. If they can draw a diagram on the white
board showing what the pieces of that project were, and how they fit
together, and can provide reasonable answers as to what was done, and
more importantly why it was done that way, then they are likely to get
the job.

The things I look for most in such an interview are if the candidate
understands how and why C++ features such as inheritance or templates
were used in a real project, and if they can intelligently discuss the
alternatives and trade-offs involved in making such choices.

I myself do not necessarily recall off the top of my head all the
intricacies of C++, nor would I expect anyone else to do so. But I do
have a feel for C++ and how to apply it to real-world programming
problems, and I have a copy of the Standard, plus a pretty good library
of other books, on hand for reference whenever I need more detailed
info.

So another thing I look for in a developer interview is what C++ books
they are familiar enough with to actually discuss some of the content.
If they are not familiar with at least some of the mainstream
literature on C++, then they are not keeping their knowledge up to
date, and are not likely to get the job.

Finally I like to know if a candidate developer is familiar at all with
comp.lang.c++.moderated and/or comp.std.c++. If they follow these
newsgroups enough to be familiar with some of the ideas being
discussed, and with some of the names we see here on a regular basis,
then that is a big plus as well.

Just my two cents worth.

Randy.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #25
Francis Glassborow wrote:
In article <11**********************@f14g2000cwb.googlegroups .com>,
Jerry Coffin <jc*****@taeus.com> writes
-> 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.
It has undefined behaviour before it tries to call a dtor (it
has the wrong return type for main().
Which means that the compiler must emit a diagnostic.
Logically, the code shouldn't even compile.
This kind of thing says far more about the testers than it
does about the tested. If the examples you give are in anyway
typical I would want my money back because they claim that
every question has at least one correct answer, that claim is
demonstrably false.


It seems obvious to me that the test is worthless, because the
authors don't really know C++ themselves. It also means that
any company using it will probably succeed in filtering out any
competent applicants.

--
James Kanze GABI Software http://www.gabi-soft.fr
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #26
Hello Matt,
As part of the interview process, I will go further and give an actual
coding assignment. A company I worked for had a standardized assignments,
asking candidates to maintain and evolve an initial program through
multiple iterations of requirements.
I find this in particular to be an excellent idea. Unfortunately, my
current environment (the very early stages of a startup company) is
prohibiting me from spending much time on test development. I may
attempt to develop and use such a mechanism in the future.

Working for a start-up company as well now, I know very well
what you mean. What I now try to do is have a few code samples
related to my field of activity, and somehow use them as
a basis for discussion (e.g. How would you fix that function?
What would you do if you now had to add this feature? ).

I know some who have also been looking for inspiration in a collection
of coding contest problems, such as http://acm.uva.es/problemset/
Alternatively, if anyone can refer me to existing, already-developed
mechanisms like this one (the changing-requirements stuff is
particularly useful), I would love to see it. The problem with those company-tests is:
- companies want to keep them private (they are typically subject
to confidentiality agreements) - to avoid cheating, and as
a competitive asset.
- the best test would be geared towards the kind of development
you are doing internally (e.g. data processing, event-based
systems and state machines, graph-based algos, etc...).
(The latter has prevented me from developing a similar test
myself...).
I suppose I could draw from past projects (...but I can't find them
anywhere...I did my C++ work a *long* time ago) or look through a
couple of my favorite books...although I'd be concerned with
plagiarism for the latter.

Can you tell us more about the type of application that the candidate
will be working on? (e.g. part of the job description?)
Kind regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #27
Carlos Moreno wrote:
Jerry Coffin wrote:
[...]
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?

150% agree with that! From experience: just asking why you might want a virtual

destructor in a class is enough to eliminate most candidates.
With regards to templates, I suspect that just plain
specialization (not even partial specialization) or even a
non-type template parameter would be just as effective.

On the other hand, do you want to weed people out because
they've been using older compilers, or because they don't know
how to program in general. Unless I had special requirements,
I'd throw in a few questions about C++, but only enough to prove
that you actually have written and compiled a correct program
(i.e. that your CV isn't totally a piece of fiction), but I
don't think I'd go much farther, on the grounds that a competent
programmer will be able to learn the more complex things if
needed, but an incompetent programmer will still be an
incompetent programmer, even if he's seen all of the latest
novelties.

The hardest thing to test, of course, is his ability to
communicate with others and work in a team. Which remain the
most important qualities.

--
James Kanze GABI Software http://www.gabi-soft.fr
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #28
"Dietmar Kuehl" <di***********@yahoo.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Jerry Coffin wrote:
[ranting about the tests removed]

Thanks for sharing your experience: I had scheduled taking the test
later today just to see how it compares to Brainbench. I made a C++
test at Brainbench a few years ago and it was similar crap: it
tested MSVC++ specifics (the '__try' and '__finally' look like
particular extensions to me), had multiple choices questions with
the right answer being absent, etc. I managed to get a rating as
"master" anyway (and I was distrubed twice by phone calls, too...).
It seems that this site is similar crap.


I sympathize. I think that the Brainbench test has improved since
you tried it. A couple of years ago, I have had the opportunity
to 'filter' the list of questions (hundreds of them!) and make a
large batch of corrections to improve style and conformance with
the C++ standard.
But this was made with very limited time and resources, and I
failed to agree with Brainbench on funding a project for renewing
the questions. I was still unhappy with the quality of many
questions, and especially with the coverage of the test
(e.g. lack of emphasis on the standard library). But I have not
been updated on the progress made since on the test.

Even though the Brainbench test may have changed quite a bit since
I reviewed it, I don't think you would find in it horrors such
as those described by Jerry in the "expertrating" one.
But it won't be flawless either...
Kind regards,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #29
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:p1********************************@4ax.com...
I find this in particular to be an excellent idea. Unfortunately,
my
current environment (the very early stages of a startup company) is
prohibiting me from spending much time on test development. I may
attempt to develop and use such a mechanism in the future.


It doesn't take very long to prepare them, it takes quite a bit of
time to administer them.
The tests themselves can be quite straightforward (we used the
travelling salesman for quite a while, but you can only use something
like that until the candidates find out about it advance).

Almost noone finished the problems set in the available time (I tried,
knowing the problem in advance and knowing simmulated annealing and it
took me about ten minutes longer than was allocated :-) but that's not
important.
You are not interested in whether or not they can solve the problem,
you are interested in how they go about trying to solve it.
Going through the candidates workings can take quite a bit of time,
but it is very informative.
Unless the candidate is a complete numpty you don't come to any final
conclusions this way, but you get information to guide your interview.

--
J.T.
Please reply via the newsgroup.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #30
Carlos Moreno wrote:

[ mention of __try, __finally, __except ... ]
WRT to C++, even D isn't
really correct, because none of them really qualifies as truly true or false, but merely irrelevant.


Actually, d) is correct, IMHO -- If there is no such thing
as a __try statement block in C++, then a statement that
says you can do whatever thing into a __try statement block
is false: it is false because there is no such thing as
a __try block, and therefore NO, you can NOT use a goto to
jump into a __try block.


Even that isn't quite true though: since all these identifiers are in
the implementor's name space, it's perfectly legitimate for a fully
conforming compiler to include them, and C++ programs that make use of
them are subject to the implementation's rules. As such, none of the
statements is really even necessarily false.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #31
Andrew Peter Marlow wrote:

[ ... ]
brainBench seems quite good to me.
It draws from a very large database, making it harder
for agents to cheat, and although it is multiple-choice
the choices have subtle differences. Also the responses
have a time limit.


BrainBench may or may not be stronger on testing methodology --
ExpertRating does have a time-limit, but I'm not sure whether the test
is a fixed set of questions or drawn from a larger pool.

At least based on my recollections from taking their C++ test years ago
(under circumstances much like this time) BrainBench's questions were
even worse though. I'd say around 70-75% of ExpertRating's questions
had reasonably correct answers among the choices given, and only about
15% or so covered truly mind-bendingly stupid subjects. In the case of
BrainBench, my recollection is that those numbers were barely over 50%
and around 30% respectively.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]

Jul 22 '05 #32
"Ondrej Brablc" <br****@gmail.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
KCs wrote:
I think that it isn't very fortunate to hire programmers testing their
knowledge of a specific language. A better approach is to test their
algorithmic skills, their thinking. A language is just a tool and

it's
usage can be learned quite fast.


Raw intelligence is of no use if it is not accompanied with knowledge.


and skill.
I have seen many people claiming to be experts in C++ and having zero
knowledge of STL. Such people would reinvent the wheel again and again,
programming their own linked lists, ... - and they would do it damned
good and in relatively short time, but would you like to maintain that
many implementations?
I feel that the paramount skill needed of a programmer is
problem-solving. A good problem solver will already know
to look for existing tools before trying to invent them.
The more astute problem solvers will also add 'standardized'
or 'in common use' to the description of sought-after tools.
(this will give a 'guideline' about how much confidence one
can place in such tools when discovered).
Of course you do not need to know all constructors from STL, but you
should now that something like this exists and you should be able to
find it in manual or in TC++PL in matter of seconds. But you must have
an overview of both the C and C++ standard library.


Yes, I agree one should have an overall view of the major
features of the standard library, and that memorizing them
is not at all necessary, they can be looked up when used.

-Mike
Jul 22 '05 #33
[ ... ]
1) Fill one or both tests from
http://www.cpp-home.com/index/tiki-list_quizzes.php (after site upgrade there something wrong with the tests)


Hmm....still somewhat short of perfect. E.g:

Q: What will !((1 || 0) && 0) evaluate to?

A. Wrong code
B. Undefined behaviour
C. I don't know
D. 1
E. 0

Without even working through the logic, it's clear that none of these
choices can possibly be correct in C++, in which the result of a
logical expression is a bool (i.e. either 'true' or 'false'). Now, if
this was about C, then D and E would be possibilities, but in C++
they're clearly not.

OTOH, this is clearly a better test than the commercial ones I've seen.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #34
"Jerry Coffin" <jc*****@taeus.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
[ ... ]
1) Fill one or both tests from
http://www.cpp-home.com/index/tiki-list_quizzes.php (after site

upgrade
there something wrong with the tests)


Hmm....still somewhat short of perfect. E.g:

Q: What will !((1 || 0) && 0) evaluate to?

A. Wrong code
B. Undefined behaviour
C. I don't know
D. 1
E. 0


F. Why the heck would someone write that expression anyway?

:-)

-Mike
Jul 22 '05 #35
"Ivan Vecerina" <NO**********************************@vecerina.com > wrote in
message news:cs**********@news.hispeed.ch...
"Gary Labowitz" <gl*******@comcast.net> wrote in message
news:74********************@comcast.com... <<big snip>> Screening tests are needed by large corporations that may receive
thousands of applications for a job opening. You can't hire them all
for 30 days based on a résumé and a nice interview chat!

Yes, tests are always flawed and biased. But by Bayesian logic, they
do help you get a vague opinion of someone's capabilities.


Well, first, that's what HR departments are for. They eliminate people who
apply for jobs. They do the initial screening and send the postcard that
says "Thanks, but no thanks" to candidates that don't look promising. (And
some people think HR departments hire employees!)

Tests I know of test such specific items that they prove little except the
test-passer knows those items. On the job you see what someone knows how to
do, and if he knows how to look up what he doesn't know. You get an example
of work done under the actual conditions. You see the interaction of the new
employee with your staff, etc. This is the only way to actually find out if
a candidate can do what you are willing to pay for. And, yes, it is
expensive to hire and then let go. But every job I've ever had was
conditional on performance. Any employer who hires and then is stuck with
who them picked is either a fool or the government.

It is just as important for the candidate to evaluate the company and job
she is applying for. We have had new hires come in and say that they didn't
think this was what they wanted and quit on the spot. Actually, this was
better for everyone in the long run, but it is tough on all the parties when
this happens.

Selecting new employees is not an easy job in any case, and shouldn't be
left to amateurs. (P.S. I have no solution.)
And we are getting way OT.
--
Gary
Jul 22 '05 #36
"Ivan Vecerina" <NO**********************************@vecerina.com > wrote in
message news:cs**********@news.hispeed.ch...

Kinda an aside:
Some years ago I was interviewing for a contract job and the nice man asked
me "What is a PCB?" Well, it didn't seem to fit the job they wanted, but I
started to explain the Program Control Block, when it's built, what it
contains, some discussion of TIOT's, the save area chain, etc. and then
asked him why this was important for this job. He said he had just heard the
term around the shop and was curious as to what it was. (I didn't get the
job anyway.)

Maybe a better technique for today is to google the candidate and see what
ng posts he has. I have made some decisions about most of YOU guys and which
of you I would like to have on my team.

How about these questions:
What is the STL?
How would you go about looking up information about vectors?
What programming language ng's do you read regularly?
Have you ever had to use bit shift operators? Tell me about it.
--
Gary
Jul 22 '05 #37

<ka***@gabi-soft.fr> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
It seems obvious to me that the test is worthless, because the
authors don't really know C++ themselves. It also means that
any company using it will probably succeed in filtering out any
competent applicants.


I'd explain to them what is wrong with the test. If they're not interested
and not willing to listen, *then* I'd walk away.

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #38
"James Talbut" <cl***********@this.is.invalid> wrote in message
news:Me********************@eclipse.net.uk...
"Matt" <ma**@downwithspammers-mengland.net> wrote in message
news:p1********************************@4ax.com...
I find this in particular to be an excellent idea. Unfortunately,
my current environment (the very early stages of a startup company)
is prohibiting me from spending much time on test development.
I may attempt to develop and use such a mechanism in the future.
It doesn't take very long to prepare them, it takes quite a bit of
time to administer them.


Depends. At some company, years ago, I had to make a very well-designed
interview test. I can't give details, it was a complex kind of state
machine. You start with a source file, part of a large application,
that 'joe hacker' wrote in a rush for v1.0 of the product.
Then you get a storyboard with multiple iterations, with new
requirements that have to be implemented for each iteration.
To end each iteration, you run a specified makefile that will compile
your updated source and link it with a test application that runs
a bunch of unit tests (each attempt is logged, and results + source
are e-mailed to the supervisor).
You are left alone for a few hours, with some books at hand if you
wish, and a phone to call your supervisor if you would like some help.

The test had been in use for several years, and data was carefully
collected. The supervisor could immediatly place you on a 'performance
percentile' based on how far you got. He could also inspect the
quality of the code produced under relative stress, and how the changing
requirements were dealt with. The reaction when in
difficulty could also be assessed (well, unless the candidate was
in the <1% who was able to get reach the last iteration on his own,
and tried to race for the virtually unreachable finish line).
The tests themselves can be quite straightforward (we used the
travelling salesman for quite a while, but you can only use something
like that until the candidates find out about it advance).


Yes, but a test problem related to your field of application
will be of greater value.
But if all you are looking for is a coding challenge, yes,
there are a number of examples available for free. Just pick one
from http://acm.uva.es/problemset/ (there are >1000, with an
online judge that will run submissions through a test harness).
These can actually serve as a good example. You could even take
a chance and remotely ask your candidate to complete one of the
provided exercices (but beware of solution code available on
various forums, and other ways of cheating...).

Such a 'coding challenge' might actually be better than a multiple
choice test for screening job candidates - but its predictive value
(w.r.t. on-the-job performance) also can be disputed...
Cheers,
Ivan
--
http://ivan.vecerina.com/contact/?subject=NG_POST <- email contact form
Brainbench MVP for C++ <> http://www.brainbench.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #39
On 20 Jan 2005 18:25:32 -0500, "Jerry Coffin" <jc*****@taeus.com>
wrote:
Q: What will !((1 || 0) && 0) evaluate to?

A. Wrong code
B. Undefined behaviour
C. I don't know
D. 1
E. 0

Without even working through the logic, it's clear that none of these
choices can possibly be correct in C++, in which the result of a
logical expression is a bool (i.e. either 'true' or 'false'). Now, if
this was about C, then D and E would be possibilities, but in C++
they're clearly not.

OTOH, this is clearly a better test than the commercial ones I've seen.


Well, it does compile and run correctly under Comeau, returning 1:

#include <iostream>
#include <ostream>

int main()
{
std::cout << "Result of !((1 || 0) && 0):\t";
std::cout << !((1 || 0) && 0) << std::endl;
return 0;
}

After all, bool is defined by the standard to be "an integral type".
Question is, whether other output != 0 (e.g. 4711) should be allowed.

Does the standard specify what the integral value of "true" should be?

--
Bob Hairgrove
No**********@Home.com

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #40
"Bob Hairgrove" <in*****@bigfoot.com> wrote in message
news:bo********************************@4ax.com...
On 20 Jan 2005 18:25:32 -0500, "Jerry Coffin" <jc*****@taeus.com>
wrote:
Q: What will !((1 || 0) && 0) evaluate to?

A. Wrong code
B. Undefined behaviour
C. I don't know
D. 1
E. 0

Without even working through the logic, it's clear that none of these
choices can possibly be correct in C++, in which the result of a
logical expression is a bool (i.e. either 'true' or 'false'). Now, if
this was about C, then D and E would be possibilities, but in C++
they're clearly not.

OTOH, this is clearly a better test than the commercial ones I've seen.
Well, it does compile and run correctly under Comeau, returning 1:


Because 'true' is output as '1' (and 'false' as 0) by operator<<,
by default (via a facet of a locale). (This behavior can be changed
(with the 'boolapha' format flag or manipulator).

#include <iostream>
#include <ostream>

int main()
{
std::cout << "Result of !((1 || 0) && 0):\t";
std::cout << !((1 || 0) && 0) << std::endl;
return 0;
}

After all, bool is defined by the standard to be
"an integral type".
Question is, whether other output != 0 (e.g. 4711) should be allowed.

Does the standard specify what the integral value of "true" should be?


================================================== ====================
ISO/IEC 14882:1998(E)

4.5 Integral promotions

4 An rvalue of type bool can be converted to an rvalue of type int,
with false becoming zero and true becoming one.
================================================== ====================
-Mike
Jul 22 '05 #41
In article <bo********************************@4ax.com>, Bob Hairgrove
<in*****@bigfoot.com> writes
Does the standard specify what the integral value of "true" should be?


When converting from bool to int, yes.
--
Francis Glassborow ACCU
Author of 'You Can Do It!' see http://www.spellen.org/youcandoit
For project ideas and contributions: http://www.spellen.org/youcandoit/projects
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #42
Bob Hairgrove wrote:
After all, bool is defined by the standard to be "an integral type".
Question is, whether other output != 0 (e.g. 4711) should be allowed.

Does the standard specify what the integral value of "true" should be?


"An rvalue of type bool can be converted to an rvalue of type int, with
false becoming zero and true becoming one." - 4.5/4

--
Seungbeom Kim

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 22 '05 #43
> After all, bool is defined by the standard to be "an integral type".
Question is, whether other output != 0 (e.g. 4711) should be allowed.
true converted to any other integer type becomes 1 -- but its own value
is true, not 1.
Does the standard specify what the integral value of "true" should

be?

Yes -- the integral value of true is exactly that -- true. bool is an
integer type that has exactly two values: false and true. When a bool
is converted to some other integer type, true converts to 1 and false
converts to 0. This is much like a null pointer: an integer constant
with the value 0 can be converted to a null pointer, but is not iself a
pointer at all. Likewise, a bool can convert to an int (or char, short,
etc.) but is not an int itself.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #44
Bob Hairgrove wrote:

[ ... ]
After all, bool is defined by the standard to be "an integral type".
Question is, whether other output != 0 (e.g. 4711) should be allowed.
true converted to any other integer type becomes 1 -- but its own value
is true, not 1.
Does the standard specify what the integral value of "true" should

be?

The standard specifies that the value of true is true. It does't _have_
an integral value; rather, it IS an integral value. Asking what the
value of true should be is roughly like asking what the value of 1
should be.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #45
> Bob Hairgrove wrote:
Does the standard specify what the integral value of "true" should
be?

Jerry Coffin wrote: The standard specifies that the value of true is true. It does't _have_ an integral value; rather, it IS an integral value. Asking what the
value of true should be is roughly like asking what the value of 1
should be.


Web page
http://www.cogsci.princeton.edu/cgi-...age=1&word=one,
defines 1 as: "the smallest whole number or a numeral representing
this number"

Similarly
http://www.cogsci.princeton.edu/cgi-...ge=1&word=true
defines true as:
consistent with fact or reality; not false
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #46

"Allan W" <al*****@my-dejanews.com> wrote in message
news:11**********************@z14g2000cwz.googlegr oups.com...
Bob Hairgrove wrote:
Does the standard specify what the integral value of "true" should
be?


Jerry Coffin wrote:
The standard specifies that the value of true is true. It does't

_have_
an integral value; rather, it IS an integral value. Asking what the
value of true should be is roughly like asking what the value of 1
should be.


Web page
http://www.cogsci.princeton.edu/cgi-...age=1&word=one,
defines 1 as: "the smallest whole number or a numeral representing
this number"

Similarly
http://www.cogsci.princeton.edu/cgi-...ge=1&word=true
defines true as:
consistent with fact or reality; not false


Now look up 'context'.

-Mike
Jul 23 '05 #47
Jerry Coffin wrote:
Bob Hairgrove wrote: [ ... ]
After all, bool is defined by the standard to be "an
integral type". Question is, whether other output != 0
(e.g. 4711) should be allowed. true converted to any other integer type becomes 1 -- but its
own value is true, not 1. Does the standard specify what the integral value of "true"
should be?

The standard specifies that the value of true is true. It
does't _have_ an integral value; rather, it IS an integral
value. Asking what the value of true should be is roughly
like asking what the value of 1 should be.


I rather agree with you, but the standard also says (§3.0./1/7):
"The representations of integral types shall define values by
use of a pure binary numeration system." Now how do you
represent "true" as a sum of powers of 2?

(Why is it that so often when reading the standard, I am
reminded of the words:
Oh, what a tangled web we weave,
When first we practice to deceive.
If they hadn't said that bool was an integer, we wouldn't have
these problems:-).

And before anyone gets me wrong, I do understand the motivations
for making bool an integral type, and given everything, I think
it was a less bad decision than the alternatives. But that
doesn't change the fact that it is a deception, and that it
leads to some tangled webs.

Such is the price of backwards compatibility. And backwards
compatibility is the price of acceptance.)

--
James Kanze GABI Software http://www.gabi-soft.fr
Conseils en informatique orientée objet/
Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #48
ka***@gabi-soft.fr wrote:

[ ... ]
I rather agree with you, but the standard also says (§3.0./1/7):
"The representations of integral types shall define values by
use of a pure binary numeration system." Now how do you
represent "true" as a sum of powers of 2?
Usually as either 1 or whatever value you assign to "all bits set": -1
on a two's complement machine, -0 on a 1's complement, INTMIN on a
sign/magnitude.
(Why is it that so often when reading the standard, I am
reminded of the words:
Oh, what a tangled web we weave,
When first we practice to deceive.
If they hadn't said that bool was an integer, we wouldn't have
these problems:-).

And before anyone gets me wrong, I do understand the motivations
for making bool an integral type, and given everything, I think
it was a less bad decision than the alternatives. But that
doesn't change the fact that it is a deception, and that it
leads to some tangled webs.
There's also the fact that the standard is sufficiently large that all
the consequences of a decision are rarely (if ever) immediately
obvious.
Such is the price of backwards compatibility. And backwards
compatibility is the price of acceptance.)


Quite true -- Objective C (for one example) is arguably more
consistent, but while it isn't obscure by any means, it certainly has a
lot smaller market share than C++.

--
Later,
Jerry.

The universe is a figment of its own imagination.
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #49

"Jerry Coffin" <jc*****@taeus.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
ka***@gabi-soft.fr wrote:

[ ... ]
I rather agree with you, but the standard also says (§3.0./1/7):
"The representations of integral types shall define values by
use of a pure binary numeration system." Now how do you
represent "true" as a sum of powers of 2?


Usually as either 1 or whatever value you assign to "all bits set": -1
on a two's complement machine, -0 on a 1's complement, INTMIN on a
sign/magnitude.


You left out Kepler ternary . (The Russians were rumored to have built a
computer that ran in it.)

Are there non-2s-complement computers being built anywhere today?

--
Vorticity Kappa

[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]
Jul 23 '05 #50

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: NotGiven | last post by:
I have been using a large hosting company and until recently, when I wanted to combine domain names and they will not let me out of a contract with two months remaining to combine accounts. they...
2
by: MLH | last post by:
I am brand new both to linux and to mysql. When I type mysql on my linux box, the mysql monitor appears. There, I know how to type help and exit. that's all I know. I need a book or online...
4
by: Savio | last post by:
Hi Freinds, I am an MCA final year student. I have heard that the MNC's always opt C as the subject for their Aptitude tests . Does anyone know which book is the best for refering C aptitude ? ...
6
by: babydavy | last post by:
I wondered if anyone knew of any online C# tests. I am a VB.NET programmer and I have been learning C# and I wanted to see if I was good enough yet to get a job using C#. Thanks, David.
4
by: Joe | last post by:
We're just starting up a site and would like to add CC processing to it. Are there any recommendations on an inexpensive merchant account (whose also trust worthy)?
12
by: antoan | last post by:
Hi, I am looking for C# practice/interview programming problems and NOT general framework explanatory questions. The ones I've come across I find a wee bit easy. I'd like to find material...
3
by: Paul | last post by:
Looking for recommendations on a programming language for a web application. I am soliciting recommendations on a programming language for a web application described below. Actually, it is not...
2
Frinavale
by: Frinavale | last post by:
I'm looking for a good code analyzing tool that can help me determine how long each method in a specified ASPX page is taking to execute. Specifically I need to find out why my page is taking so long...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.