4

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
baash05
  • 4,394
  • 11
  • 59
  • 97
  • I would be surprised if a C++ test requried knowledge of any C++ library except std::, at least without explicitly stating so upfront. Do you have reason to beleive they will? – Simon Buchan Feb 27 '09 at 08:12
  • Well.. std is my point. If a test has < stack > then I'd be screwed. Same goes for string. I've never used either. But they are in there. I mean they're simple but if I've got 1 min to answer a question. I might not have enough time to "remember" how to use them. I'd like to take tons of tests. – baash05 Feb 27 '09 at 09:48
  • 1
    The code you posted should print "Hello#" if I remember correctly, I usually have to use a book to get the iomanip sttuff correct. – James Matta Feb 27 '09 at 15:32
  • I do highly recommend [Codility](https://codility.com/programmers/lessons/). It is used by several companies for coding sessions to check if an applicant does fit to the companies needs. They have a lot of tests you can try out to simulate such test and they give you an result how good you performed for each test. Definitely give it a try. – HelloWorld Sep 20 '15 at 08:56

9 Answers9

10

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.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
John T
  • 23,735
  • 11
  • 56
  • 82
  • Concur -- MFC may have its uses even in this day and age, but few would hold it up as the shining example of how best to use C++. – Pontus Gagge Feb 27 '09 at 09:01
  • Didn't answer the question. Not one mention of the word TEST. Sorry mate. Also, if your company uses MFC, then you use MFC, or you find a new job. Agreed it's not the best, but best depends on a lot of variables. – baash05 Feb 27 '09 at 09:19
  • 1
    You said "they specifically target generic C++". MFC != generic. Question was answered. – John T Feb 27 '09 at 09:30
  • sorry john. The question was in bold. I'm not trying to learn c++. I'm attempting to take tests to practice for an exam. Agreed mfc!= generic, But I'm not looking for a def of generic. I'm looking for tests. Your answer didn't provide a test, or links to tests, or links to inteview questions. – baash05 Feb 27 '09 at 09:54
  • PS.. c++ test that has no std and mostly mfc = http://www.acuit.com/_vti_bin/shtml.dll/Test_C++.htm If that's the kind of test I get, and I'd not looked at it, I'd be screwed. – baash05 Feb 27 '09 at 09:58
  • Reading a book will prepare you for an exam. My answer still stands. Just because you found one MFC test doesn't mean most C++ tests are about MFC. If you don't like my answer, vote it down. Simple as. – John T Feb 27 '09 at 18:50
  • John. Q:Where do I find a beer store? A:If you chill your glass and eat you should be prepared for beer. Q:I didn't ask how to prepare for beer. Where do I find beer? A: it's a good way to prep for the beer. Q: Where do I find beer? A: See my point.. didn't ask how to prep. Asked for tests. – baash05 Feb 28 '09 at 12:24
  • oH come on.. they're fun john. I like the comments part of this better. Chatter between us is so limited as a group. The comments bring us together. (i did vote it down). – baash05 Mar 01 '09 at 01:45
6

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.

Community
  • 1
  • 1
Mr.Ree
  • 8,320
  • 27
  • 30
5

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 :)

Paolo Tedesco
  • 55,237
  • 33
  • 144
  • 193
4

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.

Daniel Daranas
  • 22,454
  • 9
  • 63
  • 116
2

I found these.

http://www.acuit.com/_vti_bin/shtml.dll/Test_C++.htm

http://www.acetheinterview.com/questions/cats/index.php/algorithm

http://www.faqs.org/faqs/C-faq/faq/

http://www.coolinterview.com/type.asp?iType=41

http://www.radiussg.com.au/Candidate%20Interview%20Guide.pdf

http://www.eecs.utoledo.edu/~ledgard/oop/left.html

baash05
  • 4,394
  • 11
  • 59
  • 97
  • Has anybody tried these? Feedback? I mean I can search for "C++ test" as well, but I don't want to go through a lot of crap (which I've just done). Are the above okay? – AudioDroid Feb 06 '12 at 16:57
1

Some questions in FAQ's might work as tests.

Zitrax
  • 19,036
  • 20
  • 88
  • 110
1

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!

anand
  • 11,071
  • 28
  • 101
  • 159
0

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

PapaHotelPapa
  • 687
  • 5
  • 19
0

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/

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Edouard A.
  • 6,100
  • 26
  • 31
  • Ed.. The problem is to get to the "conversation" part of the interview, I need to pass a test. Your answer's got no links to tests, or interview questions. I too prefer the 1hr 1on1. But I can't get there without 85% Got any links? – baash05 Feb 27 '09 at 11:12
  • See.. case in point Ed. I know some fantastic c++ programers, some with 20 + years who've never heard of Boost. Some of them have written low level drivers, boot loaders. Hardly amiture level work. Yet nothing about SLT or boost. You define SLT&Boost as generic, and these ppl would fail your test. – baash05 Feb 27 '09 at 12:06
  • 20 years of C++ experience and never heard of boost or stl? That's pretty odd! As for your 85%, I really think this is a bad sign for a recruitment process which was my main bullet point. – Edouard A. Feb 27 '09 at 12:28
  • @baash05: I find it incredibly hard to believe that someone who has been programming in C++ for that long hasn't even heard about at least the STL. – xian Feb 27 '09 at 13:19
  • Lack of exposure to STL/BOOST is far more common that you might think. Jobs where you are overworked (working 7 days every week, >10 hours a day, + a 3 hour commute) do not encourage learning new tools. If you are stuck with older compilers, template support is a nightmare. It happens. – Mr.Ree Feb 28 '09 at 13:00
  • Well perhaps not hearing of SLT is odd, not working with it, on the other hand. I've never met "in person" a c++ programmer who's used BOOST. I've been asking all the ones I know. SLT and BOOST are really just another set of libs. While I admit some cool fetures I seldome ever knowingly use SLT. – baash05 Mar 02 '09 at 07:00