Hi, I’m Brian, a former senior software engineer and now industry mentor at Pathrise. I have worked with hundreds of software engineers to help them land their dream jobs in tech. Check out this list of C++ interview questions from top tech companies that you can practice.
If you are preparing for interviews on a software engineering team that uses C++ regularly, the best thing you can do is practice with the types of questions you are most likely to see. When you work through these problems, make sure you mimic the interviewing environment: sit in a quiet place, speak out loud as you work through the question, and time yourself.
Review this list of 46 C++ interview questions from real tech companies and check out our tips so that you can give the best interview possible.
C++ interview questions
- Accenture question – Differentiate between class and structure in C++.
- Infosys question – What does the Friend function do in C++?
- ACI Worldwide question – What is the difference between vector and arraylist?
- Accenture question – What are the access specifiers in C++?
- IBM question – What is the “main()” function in C++? Can we run a program without the main method?
- 23andMe question – What is inheritance in regards to object oriented programming?
- Infosys question – What is the difference between abstract and interface classes?
- Google question – Differentiate between encapsulation and abstraction.
- Intel question – Write a program to print a given pattern.
- Accenture question – What is crypto currency and blockchain? How would you explain it non-technically?
- IBM question – How would you persuade a bank to replace their regular practices with blockchain?
- Accenture question – What are the differences between open loop and closed loop?
- Explain some important differences between C & C++
- Adobe question – What are the differences between C++ and Java? Which one do you think is better and why?
- Google question – What is the OOPS concept and how is it implemented in C++?
- Infosys question – What are Structs and how are they different from Classes?
- Intel question -What is the difference between reference and pointer?
- IBM question – What are virtual functions?
- 23andMe question – What is Virtual Class and Friend Class?
- Adobe question – What are Virtual Constructors/Destructors?
- Give examples of data structures in C++
- Infosys question – Tell me one disadvantage of using C++.
- Google question – How is exception handling done in C++ and Java?
More C++ interview questions
- Explain garbage collection. Does C++ have it?
- Infosys question – What is an Inline Function?
- IBM question – What is the difference between a normal pointer and a void pointer?
- Accenture question -Why is the link list used?
- IBM question – What is the Hash function? Explain with an example
- 23andMe question – What is the difference between comparator and comparable interface
- Adobe question – What is RAII?
- Point out the flaw of a class in C++.
- Infosys question – What Is the difference between Declaration and Definition?
- Explain the basic idea of constructor and destructor in C++.
- Google question – What is the difference between a mutex and a semaphore? Which one would you use to protect access to an increment operation?
- Infosys question -Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.
- Intel question – Describe the algorithm for a depth-first graph traversal.
- Infosys question – How is dynamic memory allocation done in C++?
- Adobe question – Write a function f(a, b) which takes two character string arguments and returns a string containing only the characters found in both strings in the order of a. Write a version which is order N-squared and one which is order N.
- Google question – You are given the source to an application which is crashing when it is run. After running it 10 times in a debugger, you find it never crashes in the same place. The application is single threaded, and uses only the C standard library. What programming errors could be causing this crash? How would you test each one?
- What is multithreaded programming? What is a deadlock?
Final C++ interview questions
- Intel question – You have a stream of infinite queries (ie: real time Google search queries that people are entering). Describe how you would go about finding a good estimate of 1000 samples from this never ending set of data and then write code for it.
- Infosys question – You are given a list of numbers. When you reach the end of the list you will come back to the beginning of the list (a circular list). Write the most efficient algorithm to find the minimum number in this list. Find any given # in the list. The numbers in the list are always increasing but you don’t know where the circular list begins, ie: 38, 40, 55, 89, 6, 13, 20, 23, 36.
- Google question – If you have 1 million integers, how would you sort them efficiently? (modify a specific sorting algorithm to solve this)
- Adobe question – Write code to reverse a string.
- How does C++ deal with constructors and deconstructors of a class and its child class?
- Adobe question – Create a fast cached storage mechanism that, given a limitation on the amount of cache memory, will ensure that only the least recently used items are discarded when the cache memory is reached when inserting a new item. It supports 2 functions: String get(T t) and void put(String k, T t).
Additional interview guidance
Don’t forget that there is more to a successful technical interview than just answering the question correctly. Our mentors meet with software engineers who are fully prepared technically, but still struggle in their interviews, so we wanted to give some more guidance to help you be confident in your interviews.
Start with clarifications
Once you receive the question, take 15-30 seconds to think and ask clarifying questions before jumping right into the problem. While there is a time limit, you should not feel overly rushed. Some examples of these questions would be, “Are repetitions allowed?” or “Do you want to return permutations or combinations?”
Show what you know
As you work, proactively provide information on what you are doing so that the interviewer sees that you have a solid understanding of the subject. While it might take some time away from coding, the benefit makes up for it.
Make context statements
Context statements are another way to show positive signal. If you provide reasoning for the decisions you make, you can change the interviewer’s perception of your work. This can help you if you happen to make a mistake because it gives the interviewer insight into what you were thinking.
Ask collaborative questions to get help
While you are working on the interview question, you might reach a point where you need help. Rather than asking for a “hint”, which some interviewers don’t like, try giving background on your issue and asking if the interviewer if they can help lead you down the right road. For example, you can say, “my assumptions are X and Y, I’m thinking of doing Z. But I’m struggling with solving [problem].” You can also ask:
- I was wondering if you had any thoughts.
- Do you think I’m going down the right direction?
- Do you think my assumptions are incorrect?
With these questions & tips in your back pocket, you should be more than prepared for your next technical onsite interview. Feel like you need more help? Check out these resources to practice more software engineering interview questions.
Pathrise is a career accelerator that works with students and professionals 1-on-1 so they can land their dream job in tech. With these tips and guidance, fellows have seen their interview scores double.
If you want to work with any of our mentors 1-on-1 to get help with your software engineer interviews or with any other aspect of the job search, become a Pathrise fellow.