views:

2132

answers:

14

After taking a very hard C++ aptitude test for a blue chip company, I received a rejection email the day after. I actually thought I was a very good C++ programmer, since I have had 8 years previous experience with other languages, and about 2 years academic experience in C++ with a university software engineering course. So, the test results brought me back down to earth a touch.

I'm working on some C++ open source projects, but I feel this could take a while before it gets me up to an advanced level of C++. Since I'm a applying for C++ jobs at the moment, I'm afraid that there will be many more rejection letters to come.

To the point, is it possible to self-learn advanced C++ knowledge quickly (i.e. in a few months), or will I have to accept the hard truth that this is going to take me years?

Is there a UK-based "code camp" or something like that? Perhaps there are some industry standard C++ qualifications I can take?

... I'm a very hands-on learner like most people, so I'm worried that the 'buy a book' route won't work for a quick turnaround... By the way, I'm not working right now, so I'm free to spend all day learning.

Update 1

Here's some of the questions they asked (that I vaguely remember). I would post some of the harder questions, but, well, if I could do that then I probably wouldn't be asking this question! :)

If you are creating a template, similar to Map, but wanted to define an order type, where would this functionality be placed?

Well, just remembering that off the top of my head, so I probably phrased it totally wrong. There were 4 multiple choice questions that I'm not even going to attempt to remember.

In the code sample provided, in what order are the constructors called?

Now, this is one of the easy ones. In the code sample featured, there was a number of class definitions and some virtual inheritance mixed in there. So I guess the test here was, "in what order are virtual class constructors called?" I mean, this is possible to find out by just typing some sample code, but with 3 minutes on the timer, this was apparently quite tricky.

In the code sample provided, what should the type x be?

Again, one of the "easy" ones, but not for me. So in this one, they had an operator overload for negation !, so it looked something like:

x operator!();

I can't remember what the multiple choice questions were, but I think one of them was bool, but another was "you can't overload !". A bit of searching will reveal the answer, but again, with 3 minutes on the clock, this wasn't so easy since searching for "C++ operator overload list" didn't reveal any quick reference lists.

Update 2

I didn't say I wasn't willing to learn from books; I actually have a tone of books, and they've helped a lot - the problem is that it takes a long time to really learn the content.

If books are my only option, then so be it. But if anyone knows a faster way, please share it... Are C++ courses worth the money?

+26  A: 

I would suggest the following books:

Exceptional C++ - Herb Sutter

Effective C++ - Scott Meyers

More EffectiveC++ - Scott Meyers

Modern C++Design - Andrei Alexandrescu

Whether you are able to quickly learn anything depends largely on you and your work ethic.

RC
Great selection.
Max
+1 for the Meyers books, they're really very good.
Ed Woodcock
+1 for the Alexandrescu book, but you should definitely read this after the others.
Salgar
Once you're suggesting books even though he said he wouldn't want to read (BTW; how can one write software without reading books?) I'd definitely add Konig/Moo excellent book (http://www.amazon.co.uk/dp/020170353X) even though he rejected that, too. I read it after 10 years of C++ including some tampering with TMP (I really read it for for a review, because I was teaching C++ then) and I enjoyed it a lot, even though the "only" thing it taught me back then was a new look at C++ as a high-level language.
sbi
All the questions he mentioned should be answerable by someone who has read TC++PL - and if you haven't read that, you are definitely not an experienced C++ programmer.
anon
nbolton
anon
@Neil, I will buy this right away!@sbi, Please see update #2 :)
nbolton
@Nick: "Accelerated C++" is only 250 pages. `:o>`
sbi
+3  A: 

From my experience, c++ aptitude tests usually cover basic c++, and the more advance c++ stuff is company and library dependent, depending on the job you are applying to. I would suggest refreshing yourself with basic c++ books and tutorials before even trying to learn more advance stuff. But the only sure way of learning advance c++ is to practice it and start your own personnal projects. Find something that looks fun, and do it, no matter what your experience is.

David Menard
+3  A: 

Oh man.. I was in the same situation recently.

What I'm currently doing is small enthusiastic projects using WxWidgets (preferably converters, the are really handy in means of practice) and rewriting my old C libraries to C++. While doing this, I'm trying to use containers like vectors, maps, and so on. What is important is classes and structures, inheritance.
Also, some reading. One of the questions I had failed on was the difference between virtual and pure virtual. You know, in practice, you usually don't use this.

Hope this helps.

Andrejs Cainikovs
i'll have to disagree, using pure virtual is very important, and that, again, is basic c++, not very advanced. It is crucial you know these things before you set out for a job interview.
David Menard
You are very right. The funny thing is that I don't remember using virtual at all during last few years. :-)
Andrejs Cainikovs
Because you don't make abstract classes, I do :)
the_drow
Meh. Pure virtual is only important if you are writing for other people to use your code. Otherwise you can just not use it non-purely.
Zan Lynx
+3  A: 

about 2 years academic experience in C++ with a university software engineering course.

when interviewing, I personally don't count any academic course as experience. As an ex-instructor, I know how little these things can actually impart. You don't say what level of experience the job you went for required, but at the end of the day there is no substitute for reading the classic books on C++ and gaining real experience on real projects.

Edit: Regarding your question on C++ courses. As an ex-instructor on (and writer of) such things, I would of course say yes. But in all honesty, they won't offer too much apart from the basic syntax and concepts, which I assume you already have. You will probably be much better off spending your time and money on a couple of good books and sitting down to write some code.

Of course, courses can be useful for very specific purposes, such as learing COM or sockets programming for example. Though I do remember being a bit disapointed in our own Windows programming course when I sat in on it for the first time - "So you just send messages to everything?" was my comment after the first hour, and I didn't bother much with the rest of it.

anon
Hmm, well to me it seemed advanced, but then again there were a fair few very easy questions. The job description is "entry level C++ programmer", so to a C++ veteran, I guess the level would be *easy*, but to an apparent C++ newbie, it's *hard*.
nbolton
Well, C++ _is_ hard.
sbi
@sbi actually, I don't think it is. I used to train people in it, and most people I trained at the end of the course said it was easier than learning C. Of course, there is now a big library to learn (which itself makes things easier). And I don't hear java or Python people complaining about library size. And there is lots of stuff you needn't get into like TMP - I'd expect an experienced programmer to know what TMP was, but not to be able to do it to any great extent.
anon
A test for an "entry level C++ programmer" had questions like you gave? They're nuts!
kajaco
I suspect the OP said he WAS experienced, and they give him the test based on that.
anon
@Neil: I, too, have taught C++ for many years. IMO, coming from Java, C# or whatever, C++ is pretty hard. It's disturbingly huge, complicated, full of compromises and legacy decisions. You need to tell references from objects and pointers, it has three different operators where other languages just use a `.`, you need to decide when member functions and base classes should be virtual, remembering the order-of-initialization rules in presence of MI and virtual bases is a daunting task, not to speak of exception safety.
sbi
Hmm, my CV says along the lines, "I'm an experienced programmer in x y and z, with 2 years academic C++ experience." ... It felt like that test was above the level of your average graduate programmer, so maybe they were looking for an exceptional C++ graduate?
nbolton
Ah, actually, come to think of it, there was a question on the application along the lines of C++ competency. There were 4 options; no experience, some experience, intermediate, and advanced. I chose intermediate... May be I should choose "some experience" next time?
nbolton
@sbi I suppose my advantage was I wasn't teaching to Java programmers :-)
anon
+3  A: 

Some of these questions look similar to those found in BrainBench. Every now and then the BB tests are free and you can take advantage to run though them a few times.

I would make a note of what the question is asking and then go to the standard to read up on the section involved.

Some of the questions require very close and careful study, in that they are almost like trick questions. I assume this is to sort the "best(tm)" people.

And finally, of course nobody is perfect, so there is always the chance that the answer you pick is correct, but the test doesn't agree!

Richard Corden
Ah, yes yes, it was a "Previsor" test, thanks for pointing that out!
nbolton
Richard, I've just purchased the "C++ Practice Test" and I'm doing it now, thanks for pointing me in that direction. These questions look almost identical :)
nbolton
The BB tests are crap. I worked for an IB which bought a license for them. The IB's training department had to close the website because they were getting bombarded with posts from developers pointing out errors in the questions.
anon
@Neil: I wasn't "recommending" BB either way. The key benefit with them from the perspective of the Questioner is simply as pointers to the kind of edge cases of the standard that tests such as these use. C++ is a complex language and I'm not going to state either way that the questions are perfect. TBH, I have found in the past that the expected answer reflected the behaviour of specific compilers more than the text of the standard!
Richard Corden
+2  A: 

Remember articles! Short, sweet, and covering a ton:

Also, I can't recommend the C++ Coding Standards book enough; not only is it a peek into the collective "common sense" of the C++ community, it also delves into some interesting corners of the language.

After that, keeping a subscription to the boost mailinglists or other community sources can't hurt. You'll be surprised what you pick up by just keeping an ear to the ground -- even if some of the talk is occasionally above you.

leander
A: 

The answer depends on your learning style. C++ classes might be beneficial, if a) they're sufficiently advanced, and b) you learn better in a classroom setting. The last is very important, some people just learn better from other people rather than books.

My recommendation for learning C++ is "Thinking In C++". You can get an electronic copy at Bruce Eckel's web site. (No I'm not connected to author or site).

A. L. Flanagan
+1  A: 

I've never found courses that useful. Maybe to get you started, but beyond that you rarely have the time in a course to go over more complex problems.

I think the only real way is actual development. I nearly always have a test project open in the background, which i use to quickly test some crazy coding technique, or try out a c++ question.

If nothing else offers itself then invent a small project with the sole purpose of using some advanced techniques. I'm writing a web app just to brush up some Java and learn a bit about REST, Spring JSP, JSTL etc.

jon hanson
+1  A: 

I found it helpful to buy a c++ excercise book with its solution manual.

I did most of the excercises myself, and then redid them according to their answer. I learned a lot that way.

Project Euler really has some good and fun problems as well

dassouki
+2  A: 

The key to improving ANYTHING quickly is immersion and mentoring.

You will need to commit to spending a large amount of time over the time you have available to learn about a new aspect of C++ that you don't already know, then WORKING with it.

Exercise books might help you do well on a test. They will not help you become a good C++ programmer (do you really want to get that job, then struggle to keep up?)

Find a project (maybe like previous poster, rewrite a C project you know well in C++; maybe find an open source project that is both in need of C++ and is good about providing mentoring to junior members).

Find a mentor or two (people you know; open source project members; ...)

Do nothing but work on your project, work with your mentors, eat and sleep for a few weeks (OK maybe a few other necessities of life too... but be DEDICATED to learning and improving).

Eric J.
+3  A: 

In addition to all the already mentioned things (good books, courses, participation in open-source projects and all that), here are a few things that might also help:

A very simple trick might be to subscribe to the RSS feed for C++ questions here on SO.

A wide range of questions get answered here, on every difficulty level, and they generally get very detailed answers.

It won't replace a good book on C++ of course, but it might be a good way to discover a wide range of concepts, pitfalls and solutions you might not have known about otherwise.

And get a copy of the C++ standard, and get used to cross-referencing it when you're in doubt about whether or not some code is legal. It's not an easy read, but in teaching yourself to find the information you need in it, you'll automatically familiarize yourself with a lot of the rules of the language that the compiler won't tell you about or enforce.

One of the most important things to realize when coming from another language is that you have to be a bit of a language lawyer. A lot of C++ questions here on SO are so full of references to the standard, it's almost funny. No one trusts an answer if it isn't based on the standard. "It worked when I tested it on my compiler" doesn't carry any weight.

In most other languages, you can usually get away with just experimenting and seeing what is accepted by the compiler, or what seems to work when you run it. But that won't cut it in C++ land.

jalf
If you just experiment, you're likely to stumble into unspecified, implementation-defined, or just plain undefined behavior, cases in which two different implementations might do different things and both be right. Compiler writers, in general, don't care what the compilers do in these circumstances, and won't try to keep it consistent. An experiment will tell you what happened in one case, not what will happen with another compiler, another version of the same compiler, different settings on the same compiler, or even with different surrounding code.
David Thornley
@David Um, I think that what jalf is saying, though I did have to read his last para twice to make sure :-)
anon
bah, I understood what I meant! ;)Tried to clarify a bit.
jalf
@jalf: Would you mind point me the way to subscribe to the RSS feed for C++ questions on SO?
pierr
Sure. I don't know which browser and/or RSS reader you use, so I'll just point you to the feed and hope you know how to subscribe to one when you see it. ;)Basically just go to the SO page for the C++ tag ( http://stackoverflow.com/questions/tagged/c%2b%2b ), and the feed is available from there. The direct link to the feed is http://stackoverflow.com/feeds/tag/c%2b%2b
jalf
+1  A: 

Responding to your 4th edit....

You should invest in the "c++ standard books", ie, the standard itself, the exceptional books, the andrescu book. Then, read them and apply them. Motivate yourself to find some sort of project - either open source or one you've been wanting to do. Use Boost. Then finish the project. Keep doing this for maybe 10K-20K LoC. Keep improving your code quality as you go along.

Paul Nathan
+1  A: 

I would suggest to go through the following :-

1.Read Modern C++ Design by Alexandrascu Andrei for understanding templates and metaprogramming in details.

2.Read Inside the C++ Object Model for gaining insight on the C++ object internals(inheritance, virtual inheritance, cast etc)

3.Read Effective C++, More Effective C++ for other non trivial C++ stuff.

4.Read GOF Design patterns book.

5.Try to implement a compiler for an educational OOP language such as Decaf or COOL.

sourabh jaiswal
+1  A: 

Check out the book Programming Interviews Exposed. I think that is a good resource that lists a lot of programming topics that you should know.

zooropa
Nice suggestion!
nbolton
Ha, on the UK Amazon site, one of the comments said, "I actually interviewed at Microsoft earlier this year and the person who interviewed me had this book with them!" - I clicked 'buy' immediately after reading this.
nbolton