baash05
baash05

Reputation: 4516

Sample C++ tests

I'm about to take a C++ test. But I only get one crack at it to get over 85%. If I don't push over that, then I don't get the job.

The problem with these tests are that they typically target generic C++, and depending on what libraries you use your definition of generic may differ. STL and Boost may seem logical to some (and should be part of most) but I worked with MFC for years before ever using templates. Why use >vector> when you've got access to CArray? (retorical question)

If you've worked with dialogs you've not used stdio. If you've worked with Borland products you've not used MFC. If you've worked with Palm, you've not used the file system, and you've definitely not used CFile.

OK, so here's the question...

Given that I'd like to pass the 85%, I'm taking online tests of "generic" C++. So... Is there a place I could go to find tests? The more the better. Correct answers are also good, either during or after the test. As long as I can learn from my mistakes.

EDIT: If your answer doesn't have a link to a test, some C++ questions, or some interview questions... You missed the point of Is there a place I could go to find tests?

Great example.. I've just found this question.
What does the following code fragment print? cout << setw(6) << setfill('#') << "Hello";
I've been coding for 9 years. And never used cout, setw or setfill once. Not since university.

Upvotes: 4

Views: 17097

Answers (9)

PapaHotelPapa
PapaHotelPapa

Reputation: 697

There are a few free tests here and they have explanation videos on youtube for a few of the questions.

Upvotes: 0

Daniel Daranas
Daniel Daranas

Reputation: 22644

What does the following code fragment print? cout << setw(6) << setfill('#') << "Hello";

It prints the following sentence to standard output:

Please do not work for us. We have no clue about what it means to be a good software developer.

Upvotes: 4

user36457
user36457

Reputation:

Erase all the MFC from your head for now. Go pick up a book like The C++ Programming Language, and try to learn the concepts front to back. You should be fine. If they are asking for more than this, I don't want to know what their definition of "generic" is.

Upvotes: 10

Edouard A.
Edouard A.

Reputation: 6128

During interviews I bother about the candidate being able to show me that he/she understands what he's/she's doing and that he's/she's leaning toward "modern" C++ (i.e. template intensive).

He/she also needs to understand some subtilities of the languages, but not the most arcane. I don't ask tricky question that are based on the oddities of the language. Why?

STL mastery is a pre-requisite. I see knowing nothing about Boost as a bad sign.

If I were to write a test, I would make it quite easy just to filter the really bad programmers that don't master the syntax and the logic of C++. I however prefer a one hour one-to-one interview to filter candidates.

If you find yourself fighting against a very hard written C++ test : run away.

I hope this helps.

Edit : if you really want tests and questions, check this out : http://www.gotw.ca/gotw/

Upvotes: 0

anand
anand

Reputation: 11349

IF you are going to give tests for job then brainbench tests may help. I guess C++ tests are free and you can get some idea of what kind of questions you can get.

Good luck for tests!

Upvotes: 1

Mr.Ree
Mr.Ree

Reputation: 8418

The few times I've been "tested" (well "interviewed"), folks were far more concerned with questions like:

  • What is Object Oriented Programming? OOA (analysis)? OOD (design)? UML?
  • When should you inherit from a class? When should a class be aggregated?
  • What are virtual methods? What are pure virtual methods? What is the vtable?
  • Sibling cast problem. class C : public A, public B; C c; B * b = & c; How to cast object b (type B*) to an A*?
  • What does the stack look like as a simple program executes?
  • Differences between heap/stack?
  • How does new() differ from malloc()?
  • etc.

There's lots of previous discussion on C++ interviewing questions here on StackOverflow and elsewhere:

https://stackoverflow.com/questions/240212/ what-is-the-difference-between-newdelete-and-mallocfree

https://stackoverflow.com/questions/347793/ c-areas-you-look-for-during-interview

https://stackoverflow.com/questions/365823/ what-kinds-of-interview-questions-are-appropriate-for-a-c-phone-screen

http://www.joelonsoftware.com/articles/GuerrillaInterviewing3.html

Just to add my two cents here: If they are looking for graphic details... To see if you've memorized the entire C++ spec... Well I know the economy stinks right now but it is improving, there are other jobs out there, and you NEED to find one of them. Interviews are a two-way street. If they are into nit-picking details, this is NOT a place you want to work.

Upvotes: 6

Zitrax
Zitrax

Reputation: 20314

Some questions in FAQ's might work as tests.

Upvotes: 1

Paolo Tedesco
Paolo Tedesco

Reputation: 57252

You might try Herb Sutter's book Exceptional C++; it contains items organized like questions and is, in my opinion, very clear and very well written. I don't know if it will be directly useful for the interview, but it makes you think about aspects of the language you had never considered before.

It's been a long time since I last visited it, but you might also try this site with interview questions: geekinterview.com - take a look in particular at the C++ section.

All the best for your interview :)

Upvotes: 5

Related Questions