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 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.
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! :)
Map<T>
, 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.
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.
x
be?Again, one of the "easy" ones, but not for me. 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.
I didn't say I wasn't willing to learn from books; I actually have a ton 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 [1] worth the money?
I would suggest the following books:
Exceptional C++ - Herb Sutter [1]
Effective C++ - Scott Meyers [2]
More EffectiveC++ - Scott Meyers [3]
Modern C++Design - Andrei Alexandrescu [4]
Whether you are able to quickly learn anything depends largely on you and your work ethic.
[1] http://rads.stackoverflow.com/amzn/click/0201615622:o>
- sbi
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.
.
, 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
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.
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.
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.
Some of these questions look similar to those found in BrainBench [1]. 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!
[1] http://www.brainbench.com/Remember articles! Short, sweet, and covering a ton:
Also, I can't recommend the C++ Coding Standards [5] 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 [6] 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.
[1] http://www.parashift.com/c++-faq-lite/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).
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.
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 [1] really has some good and fun problems as well
[1] http://projecteuler.netResponding 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.
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.
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.
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 [1]. (No I'm not connected to author or site).
[1] http://www.bruceeckel.comI can recommend the tutorials at www.topcoder.com. Also Google suggests this site for people that think of applying for a software developer/engineer position at their company.