Professional C__ - Marc Gregoire [502]
Types of Questions
An interviewer could ask you to explain how you can append two strings together. With this question he or she wants to find out whether you are thinking as a professional C++ programmer or as a C programmer. If you get such a question, you should explain the std::string class, and show how to use it to append two strings. It’s also worth mentioning that the string class will handle all memory management for you automatically and contrast this to C-style strings.
Your interviewer may not ask specifically about localization, but you can show your worldwide interest by using wchar_t instead of char during the interview. If you do receive a question about your experience with localization, be sure to mention the importance of considering worldwide use from the beginning of the project.
You may also be asked about the general idea behind locales and facets. You probably will not have to explain the exact syntax, but you should explain that they allow you to format text and numbers according to the rules of a certain language/country.
You might get a question about Unicode, but most likely it will be a question to explain the ideas and the basic concepts behind Unicode instead of implementation details. So, make sure you understand the high-level concepts of Unicode and that you can explain their use in the context of localization. You should also know about the different options for encoding Unicode characters, such as UTF-8 and UTF-16, without specific details.
As seen in this chapter, regular expressions can have a daunting syntax. It is unlikely that an interviewer will ask you about little details of regular expressions. However, you should be able to explain the concept of regular expressions and what kind of string manipulations you can do with them.
CHAPTER 15: DEMYSTIFYING C++ I/O
If you’re interviewing for a job writing GUI applications, you probably won’t get too many questions about I/O streams because GUI applications tend to use other mechanisms for I/O. However, streams can come up in other problems and, as a standard part of C++, they are fair game as far as the interviewer is concerned.
Things to Remember
The definition of a stream
Basic input and output using streams
The concept of manipulators
Types of streams (console, file, string, etc.)
Error-handling techniques
Types of Questions
I/O may come up in the context of any question. For example, the interviewer could ask you to read in a file containing test scores and put them in a vector. This question tests basic C++ skills, basic STL, and basic I/O. Even if I/O is only a small part of the problem you’re working on, be sure to check for errors. If you don’t, you’re giving the interviewer an opportunity to say something negative about your otherwise perfect program.
CHAPTER 16: ADDITIONAL LIBRARY UTILITIES
Chapter 16 describes a number of new features and libraries in the C++11 standard. An interviewer might touch on a few of those topics to see whether you are keeping up-to-date with the latest developments in the C++ world.
Things to Remember
The use of std::function
The Chrono library to work with durations, clocks, and time points
The C++11 method of generating random numbers
std::tuple as a generalization of std::pair
Types of Questions
You don’t need to expect detailed questions about these topics. A possible question could be to explain the usage of std::function. You might also get a question to explain the basic ideas and concepts of the new Chrono and random number generation libraries, but without going into syntax details. If the interviewer starts focusing on random numbers, it is important to explain the differences between true random numbers and pseudo random numbers.
CHAPTER 18: OVERLOADING C++ OPERATORS
It’s possible, though somewhat unlikely, that you would have to perform something more difficult than a simple operator overload during an interview. Some interviewers like to have an advanced question on hand that they don’t really expect anybody to answer correctly. The intricacies