C and C++ have both been around for a long time so there’s a lot to learn about them. There are different versions, technologies, and resources that have been built for these tech stacks. You need to use specific C and C++ interview questions as the ones you use for languages like Java simply won’t cut it. There are concepts that you simply won’t see outside of C in C++. On top of that, you need the right tech screen to see if somebody has C or C++ skills. But don’t worry, this post will give you the 411 on everything you need to know about screening and hiring C and C++ developers.
1. What is C and what is C++?
The first thing you have to understand is that C and C++ are not the same thing. As you can imagine, C’s been around a bit longer than C++. Introduced in 1972, C became the de facto standard by the end of that decade. The first C++ version didn’t appear until 1984. But once again, all it took was 10 years to catch hold. By the early 90s, C++ had gained a lot of popularity.
1.1 What is the difference between C and C++?
For one thing, C is a procedural language. C++, on the other hand, is a multiple paradigm language. It excels in procedural and object-oriented programming. In addition, new features make it a practical choice for functional programming. In most real-world cases, C++ programs will use all available programming paradigms to some degree or another. In fact, you’ll often see all three paradigms mixed together.
Programming paradigms are not the only difference between the two. C is pretty close to the machine level and is sometimes referred to as the “portable assembler.” C++, on the other hand, is closer to higher level languages such as Java, C#, and D (though still retains some of the low-level functions of C).
1.2 What is similar about C and C++?
2. What are C and C++ used for?
2.1 What is C used for?
Because they are so close to the machine level, C and C++ are mainly used for applications where processing speed and manual tuning are more important than engineering time. These included low-level programming (BIOS), embedded programming (devices), systems programming (operating systems), and performance-oriented programming (e.g. gaming engines, GPU/scientific computations, cryptography).
The real benefit C and C++ provide is giving the programmer the ability to say what happens to the program at the lowest level, closest to the machine level. On the one hand, this gives C and C++ incredible performance. The downside of this is that there’s a much lower margin of error to get the code right as they lack the memory management function of higher level languages. Practically, this means that it can take much longer to write working code in C and C++ than it does in a higher-level programming language like Java or Python.
Because C is so close to the machine level, it’s essentially the lingua franca of the programming world. Most other programming languages are built using C and most software exposes its functions in C. Almost all other languages are able to call C functions.
On a basic level, C is pretty easy to learn. Its syntax and grammar are pretty simple to learn the basics but difficult to master. Unlike other languages, C lacks the tools that lift the burden of busy work that a developer would normally like to avoid.
2.2 What is C++ used for?
C++ was partially developed to solve some of the low-level problems of C while retaining a C programming style. Unfortunately, this has meant that the learning curve for C++ is incredibly steep and it’s a much more expert-friendly language. This can make it even more difficult to use a foreign code base. Helpfully, the new versions of C++ allow the safe and easy subset of a foreign code base. Still, it’s up to the coding team to avoid using the unsafe constructs and enforce the rules.
C++ used to be an extension of C but really, that hasn’t been true since 1998. It is now very much its own language. Most C code will compile in C++ without changing it but neither is a strict subset of the other. Still, the gap between the two continues to widen as new standards are released.
2.3 What is the difference between C and C++?
C++ allows most C constructs and code to be compiled as C++ code, while also allowing more programming tools such as templates, RAII (Resource Acquisition Is Initialization), classes, lambda expressions, a bigger and more powerful standard library, and a stronger type system.
At the same time, C has some tools that C++ lacks. These include designated initializers and variable length arrays (VLAs). A general rule of thumb is that if a C++ environment is present, then you can be a hundred percent sure that a C environment is present. The opposite is not necessarily true.
3. What should an IT Recruiter know about C and C++?
C hasn’t changed in a while. The last two revisions, C11 and C18, we’re both pretty minor and didn’t offer big changes. The future C21 doesn’t seem to be groundbreaking either.
C++, on the other hand, is starting to make progress after not doing much for the past decade. There’s now a revision released every three years since C++ 11 with C++ 20 being predicted to arrive on time.
Nearly all available libraries expose a C API or binding, even if they are written in a different language. C++ can be used for all of those libraries. There are also some C++ only libraries such as Boost, Qt, and POCO.
3.1 What tools and techniques should a C or C++ developer be familiar with?
Probably the most important thing for a C developer is to have an understanding of is pointer arithmetic and what constitutes undefined behavior. In addition, a C developer should be comfortable with using debugging tools such as Address/Memory/UndefinedBehavior Sanitizer, Valgrind, debuggers (e.g. GDB), and static code analysis tools.
A C++ developer should be able to understand all of the C tools as well as the Boost and Qt libraries, well enough to be able to use them.
Beyond that, when looking at a developers experience, commercial and open source projects say the most about what they are capable of.
How to verify C and C++ developer skills in the screening phase
Technical interviews are expensive and time consuming for you and your candidates. You don’t want to interview everybody who applies. Instead, it is important to screen your candidates so that the only ones who make it to the interview stage have the technical skills needed for the job.
4. Screening a C developer or a C++ developer using their resume
The resume is the first place that you can look to find clues about what your candidate can do. For a non-technical recruiter, this can often be a difficult place to start as the information is often highly technical.
5. C and C++ interview questions to ask during a phone/video technical interview
It can be rather difficult to rely entirely on a resume. After all, it’s important to challenge the candidate on what they claim to see if they actually have the skills or are simply reporting they have them. While a phone interview doesn’t make up for a proper coding test, it can help you understand what the candidate thinks and how they go about solving problems.
5.1 Questions about the candidate’s experience
Q1: (C/C++) What were the constraints for your previous projects?
Why you should ask Q1: The candidate should be able to share their experience with the given industry. For example, in embedded programming, it’s difficult to use dynamic memory and for games, it’s very important to ensure that all calculations are finished by the time of rendering one frame.
Q2: (C/C++) Which systems did you program for?
Why you should ask Q2: In some ways, programming for Embedded/Desktop and Linux/Windows/OSX is vastly different.
Q3: (C/C++) Were you coding adhering to any specific standards?
Why you should ask Q3: The candidate may tell you if they have experience with MISRA etc.
5.2 Questions about the candidate’s knowledge and opinions
Q1: (C++) What are the main differences between C++ and C?
Why you should ask Q2: This question will allow the candidate to show their understanding of the languages, as well as whether they treat C++ as a small addition to the C language or a separate language with different usage patterns.
Q2: (C) What is pointer arithmetic?
Why you should ask Q2: This is mostly for C. This question will let the candidate express their understanding of the fundamental way C deals with memory.
Q3: (C++)What is pointer arithmetic?
Why you should ask Q3: This question will the candidate the chance to express their understanding of the fundamental way C deals with memory. Beware: for C++, this question implies using unsafe and outdated patterns in your codebase.
Q4: (C++, entry-level) What is the difference between a class and an object?
Why you should ask Q4: To determine whether the candidate understands the basics of C++.
Q5: (C++) What is a lambda expression?
Why you should ask Q5: To determine whether the candidate knows about the advancements C++ has made since C++03 (lambda expressions were introduced in C++11) and understands them.
Q6: (C/C++) What are locks, what problems do they solve and what are the potential problems with them?
Why you should ask Q6: This will show the candidate’s understanding of locks, race conditions, deadlocks, and livelocks.
Q7: (C/C++, expert) What is volatile, and how does it relate to the question about locks and synchronization?
Why you should ask Q7: The candidate should be able to tell that volatile shall only be used for accessing hardware, and not for synchronization.
Q8: (C++) How would you create a dynamic array?
Why you should ask Q8: This will show whether the candidate will use a good approach, like std::vector, or the outdated and unsafe new.
Q9: (C++) What is RAII? Do other languages have it?
Why you should ask Q9: This will show whether the candidate knows this fundamental C++ idiom and if they understand what it means. Bonus points for describing similar optional features in other languages, like with() in Python or using in C#.
Q10: (C++) Can you throw from a destructor?
Why you should ask Q10: The candidate will be able to go into details here. The gist of it is: you can, but it’s a bad practice, and it’s disabled by default since C++11, as destructors are then implicitly thrown.
Q11: (C++) Can you inherit a constructor?
Why you should ask Q11: The candidate can reply about this being possible since C++11, the slight change to the way it worked in C++14, and of the ramifications of this change.
Q12: (C++) Can you have a virtual constructor?
Why you should ask Q12: The short answer is no, but the candidate can show their quick thinking by mentioning the factory and prototype patterns.
Q13: (C++) What is an interface?
Why you should ask Q13: This is a bit of a trick question because C++ does not have interfaces. It does have abstract classes, though, and the candidate is supposed to talk about them.
Q14: (C++, expert) Can you have an implementation of a pure virtual function?
Why you should ask Q14: The answer is yes, but the usability is limited.
Q15: (C++, expert) Can you have a virtual template function and why?
Why you should ask Q15: The candidate will be able to display their understanding of the distinction between compile-time and run-time, as well as implementation details such as vtables.
Q16: (C++, expert) How would you implement std::is_same?
Why you should ask Q16: The candidate will be able to show their knowledge of metaprogramming by implementing this trivial example.
Q17: (C/C++) What is your favorite change (or a number of changes) in Cnn/C++nn?
Why you should ask Q17: To show whether the candidate keeps up with the changes in the language(s) and if they’re aware of slightly different coding idioms in different versions of the language.
Q18: (C++) What are the differences between C++98 and C++11
Why you should ask Q18: C++11 was a major shift in the C++ language, its paradigms, and patterns. The candidate will be able to show their knowledge of this major change.
Q19: (C/C++) How would you detect and fix a memory corruption bug?
Why you should ask Q19: To display the thought process, and knowledge of and tools helpful in such endeavour.
Q20: (C/C++) Do you have experience using custom allocators?
Why you should ask Q20: The candidate will be able to share their experience with custom allocators.
Q21: (C/C++) You have framework/library X in your résumé, describe your experience with it. Was using it a good choice? Is there an alternative that you had preferred, or would prefer now?
Why you should ask Q21: This is an open question, letting the recruiter know whether the candidate has a broad view of the fields, knows the alternatives, and understands the trade-offs taken by choosing one solution or other.
Q22: (C/C++) Which is your preferred build system and why? How does it compare to the competition?
Why you should ask Q22: This will show the candidate’s knowledge about build systems.