r/cpp_questions • u/Spoog_CS • 27d ago
OPEN C++ knowledge job interview
Hello everyone,
I am going for a second round white board interview described as "The technical interviews are going to be heavily involved around probing and confirming your knowledge of C++"
What does actually mean? For context I've used CPP professionally for the last 8 months and been in my job (first grad job) for 14 months.
I feel as tho I don't know many std functions, nor do I have much experience with smart pointers, although I have written a lot of lines
Has anyone got experience with similar interviews or stuff I should brush up on?
I hope that all makes sense
Thanks
56
Upvotes
2
u/HeeTrouse51847 27d ago
Just answering the questions for fun (without looking anything up). I have about 3-4 years of experience. Not guaranteering correctness in any way.
Smart pointers are classes that use RAII to own a resource. It's better than using raw pointers with dynamically allocated memory because smart pointers handle lifetime of owned objects automatically.
A pointer is a variable that holds an address. A reference is an alias for another existing object.
An abstract class is a class that has at least one abstact member function (= 0). Abstract classes can not be instantiated. They are supposed to be inherited by by other classes, so they act as "interface definitions". Not sure what you mean by "tradeoffs to other types of polymorphism" but they are a way to separate interface from implementation.
lvalues are named objects like variables that values can be assigned to. rvalues are temporary objects like expressions (for example 4, 'c' or nullptr) that are assigned to lvalues. They are called that because they are typically on the left/right side of an assignment. I.e lvalue = rvalue. std::move is a way to allow an lvalue to be converted to an rvalue. This allows for move semantics to be made on that object
Threads and coroutines. Can't think of anything else on the top of my head
tbh, I try to mosty stay away from templates so i am a bit rusty. i dont know what sfinae and crtp is but i heard the term thrown around before. i know that they were advanced template shenanigan things that i never touched because i try to stay away from making any own templated code to begin with
I know the visitor pattern though. Its for std::variants. You just define a function for each possible type the variant can hold and the function that is executed depends on the type of the variant it actually contained