25 Fundamental C++ Interview Questions

25 Fundamental C++ Interview Questions

Here, we demonstrate Fundamental C++ interview questions that are likely to come your way.  This list of questions and answers will be extremely helpful to people looking to stretch their already blossoming careers. It is imperative at any interview to be prepared and present a confident front to the interviewer. Fore warned is fore armed and these likely questions will put you firmly in that camp.

It is imperative that as a programmer you realise the enormous size of C++ as a core language. It is not difficult to fall into one of the common pitfalls; there are many mistakes that are easy to make.

When applying for a job in this field, you will need to fully understand the language and just how it acts as a tool for creating good products. Common questions are often about binary trees or linked lists.

These are designed in order that the interviewer can test the applicant on more than one capability at once. When focusing on performance it is important not to ignore theory questions about memory. It is important that applicants fully understand computer architecture, this of course enables better understanding of the need for common idioms.

Why Fundamental C++ Interview Questions Are Important

It is worth remembering that you will be dealing with C++ regardless of whether you are working as a game programmer, an engine developer, a software/tool developer or a graphics programmer. The questions though will vary depending upon which position you are applying for.

c++ interview questions

Regardless of the position for which you are applying, a solid mathematics and C++ foundation will be imperative. Graphics programmers will face questions about shaders, graphic concepts and of course 3D mathematics. For engine developers the questions are more likely to lean towards low level knowledge.

You will need to demonstrate that you can program optimally whilst also focusing on the target hardware. If your area of expertise is as a game programmer, then you will be questioned about common idioms and algorithms.

It is more important that the candidate and the job are a good fit. If only part of the job description fits your skill set, then maybe this simply is not the position for you. Interview technique is only part of the equation when job hunting. Don’t over stress on the Question and Answer part. Make sure you are competent and confident in your abilities. There is no substitute for knowledge and experience.

Yes, by all means practice your Q&A session but remember the basics will remain constant.

If you have any worries, contact us directly at Pangara, we will be only too happy to assist. Remember that math is a prerequisite for this kind of work, and whilst it may not come up in the interview stage, it certainly will as soon as the job starts. So it’s important you keep up to speed with your mathematics. The strong links between math and programming will become apparent. The sooner you spot this, the better your programming will be.

A strongly motivated candidate with drive and enthusiasm is more than a substitute for an over qualified one, with a laissez-faire attitude.

And Now to the Fundamental C++ Interview Questions

OK, so you are a talented C++ programmer and you are confident in your abilities, but you still have to get through that dreaded job interview. How do you prepare and what is likely to happen? Here is a list of questions that are likely to be asked of you at an interview. Read and memorise these and we will help you secure that life changing job.

If you don’t have time to read through all 25 Q&As, you can download a PDF version to review later.

Click here to download your questions.

1. Explain mutable and volatile keywords.

2. How many times does this loop execute? Please give an explanation.

unsigned char half_limit = 150;

for (unsigned char i = 0; i < 2 * half_limit; ++i)
[
// do something;
]


3. What is the difference between struct and class?

4. What is an object??

5. When would you use virtual inheritance?

6. When is it possible to have a recursive inline function?

7. The code featured below is inaccurate, please define the problem and explain how you would change it?

size_t sz = buf->size();
while ( --sz >= 0 )
[
/* do something */
]


8. As multiple inheritance is supported by C++, explain the “diamond problem,” with multiple inheritance that can sometimes occur? Please provide an example.

9. What does the acronym OOPS stand for?

10. What does protected access specifier do?

11. Define encapsulation.

12. Define data abstraction.

13. Define an inline function.

14. Name the storage classes that are supported in C++.

15. Explain the difference between shallow and deep copy.

16. Explain a pure virtual function.

17. Explain the function of static keyword on class member variable.

18. In C++, what data type is used to store wide characters?

19. Which operators are used to access class members?

20. Which data type would you use to store the Boolean value?

21. Define function overloading.

22. What is a destructor and can it be overloaded?

23. Define the term constructor.

24. Is it possible to use the () malloc function of C language in C++ to allocate dynamic memory?

25. Define namespace.

We’d like to thank Vinh Đoàn Thế’ for lending his C++ expertise to this article.

PANGARA_LOGO_

If you’re ready to take the next step and join Pangara’s exclusive network of freelancers, then let’s get started! Become a Pangara Talent today. 

Stay tuned for Pangara’s latest news updates and events on our Facebook page, LinkedIn and Twitter.

 

Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedInEmail this to someone