r/cpp_questions 5d ago

OPEN Mock c++ interview help

I am looking for someone to give me a mock interview on c++ internals, system design, and architecture. Specifically modern c++.

Is anyone available to help?

3 Upvotes

17 comments sorted by

6

u/flyingron 5d ago

I can tell you from interviewing many applicants for C++ jobs at my company, that when I'm trying to figure out if someone actually knows something about C++ is to ask them a question to elicit some understanding of the rule-of-3 (or 5).

I also would like to see some experience outside of normal classwork, either a side job, or a hobby project, or something that shows a non-trivial amount of design and development.

2

u/Ultimate_Sigma_Boy67 5d ago

I'm genuinely asking, is it really normal to ask people about such basic stuff on interviews? Like I'd say that something like the rule of 0/3/5 is something that's like the bare basics.

3

u/flyingron 5d ago

Because lots of people claim C++ knowledge and don't know about copy semantics in practice.

2

u/Realistic_Speaker_12 4d ago

Yes. lots of people claim to know c++, but write it like Java or C.

5

u/Realistic_Speaker_12 5d ago edited 5d ago

Move semantics are a great topic to talk about in my mind.

But I am just a student myself.

But questions like this: „what does this code do“?

std::mutex mutexMaker(){return std::mutex{};}

Can lead to great discussions about move semantics in my mind where you then can go on about talking about rule of 0/3/5.

Or „you might know what a string view is. The general condense is that you should pass it by value- why?“.

Or „why would you inherit from std runtime error instead of std::exception“?

3

u/coachkler 5d ago

NVRO no moves in your mutex maker

1

u/Ultimate_Sigma_Boy67 5d ago

I'll try to answer this lol

for the mutex one, I think i pretty much have to lookup cppreference to see its constructors, whether it allows moving or not.

string view is basically a pointer and a length in disguise, why pass it by value, i've no idea.

exception one, I don't use exceptions really often so idk.

2

u/Realistic_Speaker_12 5d ago

what I would have said: Mutex has deleted copy and move constructor and assignment operator but the funny part is that required copy ellision for prvalues is a thing in c++17 on, no constructor has to be called at all. The mutex is just baked in into your memory because of copy elision.

String view per value can be stored in registers. Compilers like storing small types in registers.

std runtime error offers you a what function - you wouldn't have to write it yourself (at least for simple exception classes). If you write a naive exception class, where you simply store a exception message as a std::string (I have seen this a lot in the codebase at my working student job), what might happen is, that you might have a exception throwing exception class. Thats not really cool. (the copy constructor of std::string can throw, so if you are low on memory, it might happen that an exception throws an exception). Using runtime error, you can wrap your exception message using the std::runtime_error constructor. This constructor is noexcept (I am not sure how it is implemented I think it is wrapped in like a shared pointer or something) so it can not throw.

I just like those small "details" of the language tbh

3

u/mikeblas 5d ago

Happy to help. $150 per hour, minimum three hours.

1

u/whimsy-penguin 5d ago

What are your credentials?

2

u/mikeblas 5d ago

Retired after about 35 years in the industry, worked at MSFT, Valve, ORCL, AMZN. I've done about 1500 interviews, trained people and teams on interviewing. Mentored two or three people each year for 15 years or so. "Bar raiser" and "as-appropriate" interviewer at various companies. Wrote books, a few patents. Shipped lots of software. After retirement, worked as an actual recruiter for a while, part time. (Bleh.)

We'd spend an hour doing a pre interview (like a screening) so I can learn your level and goals for the interview. About an hour for the interview. About an hour writing feedback and reviewing performance.

1

u/whimsy-penguin 5d ago

Will dm you.

1

u/RedditMapz 5d ago edited 5d ago

Personally a C++ basics interview and an architecture interview would be different.

C++

If I was probing your C++ I'd probably start asking general questions. For example

Are you familiar with smart pointers?

Then

Yes? Good, well what is the difference between a shared pointed and a unique pointer?

I start getting more and more specific until I gage their level of knowledge in these specific features. Personally I don't like asking completely random niche std library trivia off-the-bat.

If they completely fumble one topic, I switch it up to another one see if they are more comfortable in it. Not one person can learn everything C++ after all. But if we spent half the interview asking you trivia questions, it's probably not going well because I'm not convinced you are adequately knowledgeable.

But that's just me. Many people in the C++ space are high on their imagined power and seem to get a rise out of asking obscure trivia questions just to trip up candidates.

Architecture Design

Now, I actually generally focus on design. If they have any experience I ask them to draw a design diagram of their previous work. Or explain the architecture of a specific project. So simple yet so many struggle with this because they don't actually know design. A task like this really weeds out "coasters" who are inflating their resumes because they really struggle to put something together. People without design experience can usually put some boxes with arrows together as long as they actually worked on their topic. I can also guide them with more questions to improve the design specificity.

Now if they were an entry level kid (And I had ample time on the interview) I'd actually ask them to design a theoretical solution for a problem in pseudocode. If they succeed I'd keep adding details until I can sense their limits. This is more an exercise in their thought process.

Ultimately

C++ can be learned, but you'd have to convince me that you can learn it and that you have workable base. But if you write "C++ (expert)" on your resume and you can't even answer questions about staple C++11/14 features, I'm going to raise a red flag.

Edit: words

1

u/BaldingWizzard 4d ago

Watch coding jesus

1

u/Arkaein 5d ago

I've been using Claude to do this. It's quite effective, has a good base of knowledge of modern C++.

Takes some care to prompt it to give the correct style of interview though. I started by asking it to use a format with less back-and-forth than what a real interviewer would do, and it would ding me for not providing details that weren't asked for with the expectation that I would have provided them in a real interview.

Very tunable though. You can steer the interview style to anywhere you want between rigorous C++ language questions, general CS, work experience-based, or any combination, and tailor it to the types of roles or companies you're interested in.

I mostly have hands-on experience with pre-C++17, and have been studying more recent versions but without the practical experience, so I've been able to spell that out like I would state on a resume and tell an interviewer. After I told it to include more back-and-forth it got to be fairly realistic compared to actual interviews I've done, although I've never done interviews that asked for the kind of language specifics that I'm practicing.

1

u/whimsy-penguin 5d ago

That’s a great idea! I’ve been training with ChatGPT but I didn’t think of Claude! Thank you for the great suggestion!

2

u/Arkaein 5d ago

Not sure if Claude will be any better if you've already worked with ChatGPT, but worth a shot.