views:

768

answers:

12

i have to prepare for an interview in C++ technology. could you please drop in your suggestions and recommendations about how to start and what are the basic topics that i have to concentrate mostly on? i have a prior knowledge on the topics but i am confused with what to concentrate on as C++/C are very vast.also i think that i have to concentrate on more data stuructures using c/C++. is that a good decicsion to do some practice on them?

+8  A: 

go over the C++ faq lite: http://www.parashift.com/c++-faq-lite/ its will give a tour around the language and its more obscure corners

Alon
That's what I wanted to recommend.
ziggystar
+1  A: 

I think that i have to concentrate on more data structures using c/C++. is that a good decision to do some practice on them?

Yes. Know how to implement and traverse lists, trees, and stacks. Almost every interview will more than touch on these areas. And I mean know how to implement this stuff yourself - not by relying on libraries or the STL (though you should be aware of how you would use the STL instead of implementing this stuff on your own in the real word, and be able to explain how you'd use the STL).

This isn't to say this is all you need to brush up on - but know how to deal with binary trees backwards and forwards.

Michael Burr
I concur - also make a point to be familiar with the STL.
Chris
+16  A: 

IMO, if you feel that you have to "swot" for a technology interview, you are not really qualified for the job. Or at least, you are lacking the required experience.

That even includes an entry-level position for someone straight out of Uni. If they are recruiting someone for an entry-level position, they should make allowances for lack of experience. But if they want someone with experience in C++, no amount of last minute swotting will make up for lack of experience.

My advice is to do some C++ programming; e.g. at home, at Uni, in your current job. THEN apply for C++ positions.


swot: verb, swot⋅ted, swot⋅ting, noun British Slang.

–verb (used without object)

  1. to study or work hard.
Stephen C
By "swot" do you mean "Strength/Weakness/Opportunity/Threat" analysis or something else?
Michael Burr
Swot: also appears in the phrase "girly-swot" - derogatory term used by people who haven't studied to disparage those who have. I can't believe such a rich word hasn't crossed the Atlantic :-)
Andrew Shepherd
While I don't think someone should expect to be able to 'pass' an interview simply by cramming for a couple days beforehand, I think - like any test - it's worthwhile to do some exercises. Since I'm not writing the STL libraries for a compiler, I code up low-level tree implementations far more in interviews than I do in my day-to-day work. So between interviews, I use the libraries and that stuff gets rusty. Unfortunately, in an interview, they don't usually like "I'd just use a `std::multiset` for that" as an answer.
Michael Burr
@Stephen and Andrew - (OT) you Brits have a nice flair for slang.
Michael Burr
@Michael - your situation sounds different to the OP's. Brushing up on rusty skills versus (it sounded like) trying learn stuff at the last minute.
Stephen C
@Michael - I should be offended by that. I'm not a Brit.
Stephen C
@Stephen C - you weren't offended? I've gotta work on my 'Social Skills of a Thermonuclear Device' techniques. I knew I should have spelled your name wrong...
Michael Burr
@Michael: If I am doing the interview, the fact that the interviewed knows about multiset is a point, knowing how to implement it is probably worth a whole set of points, but that boils down to the 'solver' or 'executor' type of people. I prefer solvers to executors, but a solver that knows the domain is better than reinventing the weel.
David Rodríguez - dribeas
This is why colloquial answers shouldn't be upvoted. People across the pond need to 'get' extra information just to understand the post.
George Stocker
+4  A: 

I would recommend familiarity with the STL. Especially algorithms and function objects. Templates are a must.

rlbond
Would you mind explaining why "Templates are a must."? Thanks.
pierr
Because they are a very important technique in contemporary C++? From all the tools in my box, I often feel templates are the mightiest.
sbi
Ahhh... The Algorithms at last! +1 for that! I even daresay the intention of Stepanov was to _first_ look at the algorithms to use, _then_ decide on the data structures.
xtofl
+4  A: 

This question ( C++ areas you look for during interview ) might help you.

aJ
A: 

When I got my first co-op, I didn't know too much C++ or C, but I knew a TON of Java, so I spent a couple days on reading wikipedia on the main differents, and then I went on to do a couple of small coding projects to understand the syntax and what exactly what was going on with pointers. C++ takes practice, but hey, I was able to get the job with just a couple days of studying.

Some important things to know would be how pointers work, the virtual and nonvirtual functions, the STL, inheritence, and polymorphism. Thats just a couple ;) And I'm assuming you know one particular language well, so I won't bug you about knowing your datastructures (lists, heaps, stacks, etc) and search/sort algorithms.

Good luck :)

shawnjan
A: 

I don't think that your question is specific enough for a good answer. Nonetheless, here's what I recommend:

  1. C++ occupies a middle ground between C and Java: It is object-oriented, but you must perform your own memory manipulation. Know both forms of the new and delete methods. Know pointer arithmetic.
  2. Be sure that any readings that you do about C++ is fairly modern (written in the last 10 years) and includes the changes that were made with C++98, particularly the STL.
  3. Know the standard library backwards and forwards. Know what does not appear in the standard library.
  4. Know how to make both function and class templates, and when they're best used.
  5. Expect questions about the differences between C++ and Java, and about the differences between C++ and C#.

If you really want to work your brain, learn about BOOST.

Good luck in your interview!

Chip Uni
C++ isn't object-oriented, it's _also_ object-oriented. It's a multi-paradigm language that's strongest when you mix paradigms.
sbi
+10  A: 

To me it all boils down to sincerity. Be sincere of what you know and what you don't. Take a look at common idioms (RAII is a must know, references/pointers, STL containers and iterators you should at least know what they are used for and transversing a container with iterators)... but be clear on what you really know and what you just know something about.

I have employed people that knew nothing of C++ and was clear about it in the first place. I will always prefer a candidate that does not know, accepts it and is willing to learn that a candidate that thinks that knows and fails to do so. Answering a question takes a few seconds of my time as long as the person learns from it.

Being clear on what languages you really know and your current level in C++ will allow the interviewer to get a feeling of your C++ knowledge in a couple of questions but turning into another language for more complex programming problems. I'd rather take a person that knows how to tackle a problem in another language than someone that knows the language but will not solve problems.

C++ is a hard language, if you insist that you know it while you don't, the most possible outcome is that you will make mistakes in the interview and show how much you know/lack.

David Rodríguez - dribeas
+1 - be truthful. Don't try to fake it.
Stephen C
Sincerity? I can fake that!
Michael Burr
+1  A: 

I would re-read or skim through Effective C++. I'd do this whether I'm used to writing C++ everyday, or if it's been a while since doing much C++.

If you lucky, the interviewer will have you write a bit of code. If not, the interviewer usually has to ask questions to see how familiar your are with the language. For example, you might be asked 'why should you always declare a destructor as virtual?'. Well, you may have been declaring your destructors virtual for the last 10 years, but not be able to remember why.

I think a quick re-read or skim through Effective C++ will help you remember what you already know.

brianegge
+1  A: 

The necessary (but not sufficient) part of doing well on an interview about C++ is being good at writing code in C++. The only way to be good at writing code in C++ is to do it, a lot.

Good interviewers will be able to discern if you know how your language of choice works without asking what I call "vocabulary" questions (what does keyword 'x' mean). They'll ask you to implement something that will be much easier if you know particular features of the language (templates, polymorphism, overloading, etc). This isn't stuff you can cram for, it's stuff you have to know in your bones, and again the way to get that is to write lots of code.

An ancillary skill you'll need is interviewing well to showcase your skill in C++. Thankfully this requires far less practice. I strongly suggest getting together with friends and practicing interviews with a whiteboard -- search this site and the rest of the web for known interview questions, and answer them at the whiteboard (in C++ in this case), in front of your friends. Take turns. Grill each other. Get so that you can easily write code in front of other people, on a whiteboard, with no IDE to help you out. That'll let you show off your real skill.

Moishe
A: 

Study stl, templates and virtual destructors for sure atleast.

Vivek
A: 

Apart from other suggestions:

  • Be sure to spell the language names correctly ("C++" and "C").
  • Prefer not to build with them phrases like "c/C++" or "C++/C". When refering to both languages, just say "C and C++", or "C or C++".
Daniel Daranas