Photo of C++ interview questions from top tech companies

46 C++ interview questions from top tech companies

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

  1. Accenture question – Differentiate between class and structure in C++.
  2. Infosys question – What does the Friend function do in C++?
  3. ACI Worldwide question – What is the difference between vector and arraylist?
  4. Accenture question – What are the access specifiers in C++?
  5. IBM question – What is the “main()” function in C++? Can we run a program without the main method?
  6. 23andMe question – What is inheritance in regards to object oriented programming?  
  7. Infosys question – What is the difference between abstract and interface classes?
  8. Google question – Differentiate between encapsulation and abstraction.  
  9. Intel question – Write a program to print a given pattern.
  10. Accenture question – What is crypto currency and blockchain? How would you explain it non-technically?
  11. IBM question – How would you persuade a bank to replace their regular practices with blockchain?
  12. Accenture question – What are the differences between open loop and closed loop?  
  13. Explain some important differences between C & C++
  14. Adobe question – What are the differences between C++ and Java? Which one do you think is better and why?
  15. Google question – What is the OOPS concept and how is it implemented in C++?
  16. Infosys question – What are Structs and how are they different from Classes?
  17. Intel question -What is the difference between reference and pointer?
  18. IBM question – What are virtual functions?
  19. 23andMe question – What is Virtual Class and Friend Class?
  20. Adobe question – What are Virtual Constructors/Destructors?
  21. Give examples of data structures in C++
  22. Infosys question – Tell me one disadvantage of using C++.
  23. Google question – How is exception handling done in C++ and Java?

More C++ interview questions

  1. Explain garbage collection. Does C++ have it?
  2. Infosys question – What is an Inline Function?
  3. IBM question – What is the difference between a normal pointer and a void pointer?
  4. Accenture question -Why is the link list used?
  5. IBM question – What is the Hash function? Explain with an example
  6. 23andMe question – What is the difference between comparator and comparable interface  
  7. Adobe question – What is RAII?  
  8. Point out the flaw of a class in C++.
  9. Infosys question – What Is the difference between Declaration and Definition?
  10. Explain the basic idea of constructor and destructor in C++.
  11. Google question – What is the difference between a mutex and a semaphore? Which one would you use to protect access to an increment operation?
  12. 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.
  13. Intel question – Describe the algorithm for a depth-first graph traversal.
  14. Infosys question – How is dynamic memory allocation done in C++?
  15. 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.
  16. 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?
  17. What is multithreaded programming? What is a deadlock?

Final C++ interview questions

  1. 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.
  2. 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.
  3. Google question – If you have 1 million integers, how would you sort them efficiently? (modify a specific sorting algorithm to solve this)
  4. Adobe question – Write code to reverse a string.
  5. How does C++ deal with constructors and deconstructors of a class and its child class?
  6. 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.

Photo of C++ interview questions
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.

Apply today

Pathrise logo

Leave a Reply

Your email address will not be published. Required fields are marked *