By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,213 Members | 1,296 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,213 IT Pros & Developers. It's quick & easy.

I had a C++ interview, here are some questions

P: 1
Hello everyone,,

I had a C++ phone screen and I thought some people might be interested in seeing the questions that were asked. Here they are:

If you could change one thing about the C++ language, what would you change and why? What are some limitations of c++?
Could you explain to me how virtual functions work? and why you would use them?
What is the overhead of calling a virtual function?
Are there any situations when this overhead is larger or smaller?

When should you make a destructor virtual?

Could you explain to me the difference between static_cast and dynamic_cast?

How would you implement a class that opens two files if you could not use exceptions?

How would you implement that class with two files using exceptions?

How would you handle one of the files failing to open in the case where you have exceptions?

Could your constructor throw an exception after one of the files had been opened and the 2nd one failed? Which destructors would be called in this case? (assumes use of RAII for file handling (which is how I answered the previous questions))

How would you find the 10 most used words used in a large text file (which was a novel)? file -> words -> hashmap<string word, int count> ->keep track of top 10 using a vector.
1 Week Ago #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.