Vai al contenuto
Colloquio tecnico
C and C++: software engineer interview questions

Screen C and C++ Developers Skills

Colloquio tecnico
C and C++: software engineer interview questions

C and C++ developers don’t get the same buzz as developers in other languages. They aren’t as ubiquitous as JavaScript developers. They aren’t as well connected to hot topics like data science as Python developers. They don’t use a technology as up-and-coming as Kotlin developers do. But unlike the technologies making all the headlines, C and C++ continue to be the workhorses of many essential systems as well as areas like embedded technology and gaming. As a result, there is still a lot of demand for C and C++ developers. So the question becomes, how do you screen C and C++ developer skills?

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.

In this guide you’ll find:

c++ developer skills list1. 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++?

Beyond these differences, it’s certainly true that there are some similarities. The syntax used by both these languages is often called the “C family syntax.” Because C has been so popular, you’ll actually find that C grammar and syntax is a basis for a number of programming languages such as Java, C#, C++, D, Objective-C, JavaScript, and many more.

What are C and C++ used for?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.

What should an IT Recruiter know about C and C++?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.

Verify C and C++ skillsHow 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.

RECOMMENDED READING: Complete C++ developer salary data

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. To help you out, we’ve put together a list of things to look for on a C and C++ developer’s resume.

C and C++ glossary4.1 C and C++ glossary for technical recruiters

C libraries The C Standard Library

  • The library described by the C standard document, shipping with each compiler

Other, less universally used, but still popular libraries:

GTK

  • A library for creating graphical user interfaces

Cairo

  • A 2d graphics library

ALSA

  • A library to interface with Advanced Linux Sound Architecture

BLAS

  • Basic Linear Algebra Subprograms. This library is used for efficient vector and matrix operations

GMP

  • GNU Multi Precision. A library providing for arithmetic operations on arbitrary-precision numbers

cURL

  • The multiprotocol file transfer library. Most commonly used for HTTP communications

OpenSSL

  • A commercial-grade and wildly popular library used for cryptography support
C++ Libraries The C++ Standard Library

  • The library described by the C++ standard document, shipping with each compiler

Boost

  • One of the most popular libraries for C++, a set of several dozen disconnected libraries that can be freely used in C++ programs

Qt

  • The go-to GUI framework for C++

STL

  • A controversial acronym, which usually means C++ Standard Library, but is understood as Standard Template Library, as if the non-template parts weren’t a part of it

Other, less universally used, but still popular libraries:

Eigen

  • C++ template library for linear algebra (matrices, vectors, numerical solvers and related algorithms)

GSL

  • Guidelines Support library implementation, recommended by Bjarne Stroustrup, Herb Sutter, and Co. in C++ Core Guidelines

Loki

  • design patterns

Folly

  • A set of C++11 components extending the standard library. Designed with efficiency and practicality in mind. Developed by Facebook

Abseil

  • A collection of C++ libraries extending the standard library. Created by Google

POCO

  • A set of libraries supporting HTTP, networking, encryption and zip file support

WxWidgets

  • A library allowing the creation of system-independent GUI applications

OpenCV

  • A computer vision library, designed for computational efficiency with a focus on real-time applications

OpenMP

  • Less of a library, and more of a specification for compilers how to extend C++ to allow simple and well-designed parallelism

IntelTBB

  • A template library for task parallelism. Designed by Intel
Compiler The tool used to create an executable (an application) from the C/C++ source, most popular:

  • GCC – GNU Compiler Collection
  • MinGW GCC – Windows version of GCC
  • Clang – Compiler by the LLVM project
  • MSVC (also called, somewhat incorrectly, MSVS or Visual Studio) – Microsoft’s Compiler
  • ICC – Intel’s compiler
Debugger A tool to find bugs in running programs

  • Valgrind
  • GDB
  • LLDB
  • WinDBG
Code instrumentation This is an extension to the compiler to produce an application version that is aimed at finding bugs instead of performance

  • Address/Memory/UndefinedBehavior Sanitizer
Static analysis An analysis of the source code in terms of bugs. Commercial software exists that can find some classes of bugs this way

  • CppCheck
  • Clang
  • Klocwork Static Code Analysis
  • PC-Lint
  • Coverity
  • PVS-Studio

4.2 The most common C and C++ technology names that are used interchangeably

  • The C++ Standard Library and STL are sometimes used interchangeably, but not correctly

4.3 The different versions of C and C++

Versions of C

Versions of C are labeled with the year they were released (e.g. C89 is C from 1989). There are no in-between versions (e.g. C06), but some may refer to pre-C89

The most popular revisions are:

  • C89
  • C95
  • C99
  • C11
  • C18
  • C21 (not published yet),
  • ANSI C

Versions of C++

Versions of C++ are labeled the same way as versions of C with the year they were published.

The most popular revisions are:

  • C++84 – not a real revision, but sometimes used to define pre-standard C++
  • C++98
  • C++03
  • C++11
  • C++14
  • C++17
  • C++20 (not published yet)

In addition, you may see the names the versions were given while they were being developed.

  • C++0x (in-progress name for C++11, which was supposed to ship before 2010)
  • C++1y (in-progress name for C++14)
  • C++1z (in-progress name for C++17)
  • C++2a (in-progress name for C++20?)

4.4 How close respective versions of C and C++ technologies are to each other

  • C11/C18 –  nearly the same
  • C++98/C++03 – nearly the same
  • C++11/C++14 – minor changes
  • C++14/C++17 – minor changes (but enough to make the difference between C++11/C++17 significant)

4.5 Which versions are completely different?

  • C++03/C++11 – the biggest change in C++ history
  • C++11/C++17 – gradual change over revisions
  • C89/C99 – major changes in terms of type safety and support for legacy problem code

4.6 How important are C and C++ certificates for assessing a candidate’s coding skills?

There are no respected C/C++ certifications. As a result, it is best to ignore any on a resume as they won’t tell you anything about the candidate’s skill level.

4.7 Other things to look out for on a C or C++ developer’s resume

Look out for whether the candidate:

  • Specifies the version of the language they have used
  • Has worked on a typical C++ project
  • Has participation in large projects, dealing with unique and stringent requirements

Additionally, if the following are mentioned, technical interviews can assess the candidate based on their publicly visible history:

  • Speaking at conferences
  • Attending conferences
  • Writing articles to technical magazines
  • Writing a technical blog
  • Contributing to OSS
  • Contributing to answer sites (e.g. Stack Overflow)

C and C++ phone interview questions - c++ developer skills list5. 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 nothrow.

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 a 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 endeavor.

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.

5.3 Behavioral Questions you should ask to understand how the candidate has acted in the past

Q1: What is your biggest programming success story? Why did it happen? How can you repeat it?

Why you should ask Q1: This question will allow the candidate to present a success story and will show the recruiter whether the candidate is more interested in solving the problem or getting the praise.

Q2: What was your biggest programming failure? Why did it happen? How can you avoid repeating it in the future?

Why you should ask Q2: This question will allow the candidate to present a potentially troubling story, and will show the recruiter whether the candidate is open about it. It will additionally show if they are more interested in solving the problem or shifting the blame.

Q3: (for more senior-level applicants) Would you like to mentor a junior developer? Why? How would you go about doing it? Do you have any experience mentoring other people?

Why you should ask Q3: This will allow the recruiter to gauge the candidate’s interest in and the necessary soft skills required for sharing knowledge.

Technical screening of C and C++ developer skills6. Technical screening of C or C++ developer skills using an online coding test

The thing you need to be absolutely clear about with C and C++ developers is that it is essential that they have immaculate coding skills. C does not allow for any margin of error and C++ doesn’t allow for much more. Certainly, a resume screen and phone screen can help you weed out some of your candidates. That said, the last thing you want to do is invite a candidate to a technical interview only to find that they never had the coding skills you need all along.

6.1 Which C or C++ online programming test should you choose?

Quando si cerca il giusto C or C++ online programming test you should make sure they match the following criteria.

  • They reflect the real work being done
  • They don’t take too much of the candidates time, one to two hours max
  • They can be sent automatically and can be taken anywhere
  • They go beyond checking whether the solution works to also check the quality of the code and how well it works in edge cases
  • They’re as close to the natural programming environment as possible and let the candidate access the kinds of resources they normally would at work
  • They let the candidate use all the libraries, frameworks, and other tools they normally would use
  • They are at a proper level that matches the candidate’s abilities

7. DevSkiller ready-to-use online C and C++ developer coding assessment tests

DevSkiller coding tests use our RealLifeTestingTM methodology to mirror the actual coding environment that your candidate works in. Rather than using obscure algorithms, DevSkiller tests require candidates to build applications or features. They are graded completely automatically and can be taken any from anywhere in the world. At the same time, the candidate has access to all of the resources that they would normally use including libraries, frameworks, StackOverflow, and even Google.

Companies use DevSkiller to test candidates using their own codebase from anywhere in the world. To make it easy, DevSkiller also offers a number of pre-made C and C++ coding tests like the ones here:

Get started with
DevSkiller oggi

Scoprite come DevSkiller può aiutarvi a crescere.