Professional C__ - Marc Gregoire [495]
Design patterns are a terrific way to end your journey through Professional C++ Programming because they are a perfect example of how good C++ programmers can become great C++ programmers. By thinking through your designs, experimenting with different approaches in object-oriented programming, and selectively adding new techniques to your coding repertoire, you’ll be able to take your C++ skills to the Professional level.
Appendix A
C++ Interviews
Reading this book will surely give your C++ career a kick-start, but employers will want you to prove yourself before they offer the big bucks. Interview methodologies vary from company to company, but many aspects of technical interviews are predictable. A thorough interviewer will want to test your basic coding skills, your debugging skills, your design and style skills, and your problem-solving skills. The set of questions you might be asked is quite large. In this appendix, you’ll read about some of the different types of questions you may encounter and the best tactics for landing that high-paying C++ programming job you’re after.
This appendix iterates through the chapters of the book, discussing the aspects of each chapter that are likely to come up in an interview situation. Each section also includes a discussion of the types of questions that could be designed to test those skills, and the best ways to deal with those questions.
CHAPTER 1: A CRASH COURSE IN C++
A technical interview will often include some basic C++ questions to weed out the candidates who put C++ on their resume simply because they’ve heard of the language. These questions might be asked during a phone screen, when a developer or recruiter calls you before bringing you in for an in-person interview. They could also be asked via e-mail or in person. When answering these questions, remember that the interviewer is just trying to establish that you’ve actually learned and used C++. You generally don’t need to get every detail right to earn high marks.
Things to Remember
main() and its parameters
When you are applying for a platform specific job, check what kind of main() function and which parameters that platform might use, for example, on Windows, your program might use WinMain(), _tmain(), wmain(), and a few others.
Use of functions
Header file syntax, including the omission of “.h” for standard library headers
Basic use of namespaces
Language basics, such as loop syntax, the ternary operator, and variables
The difference between the stack and the heap
Dynamically allocated arrays
Use of const
What references are
The C++11 auto and decltype keywords
Types of Questions
Basic C++ questions will often come in the form of a vocabulary test. The interviewer may ask you to define C++ terms, such as const or static. He or she may be looking for the textbook answer, but you can often score extra points by giving sample usage or extra detail. For example, in addition to saying that one of the uses of const is to specify that a reference argument cannot be changed, you can also say that a const reference is more efficient than a copy when passing an object into a function or method.
The other form that basic C++ competence questions can take is a short program that you write in front of the interviewer. An interviewer may give you a warm-up question, such as, “Write Hello, World in C++.” When you get a seemingly simple question like this, make sure that you score all the extra points you can by showing that you are namespace-savvy, you use streams instead of printf(), and you know which standard headers to include.
CHAPTER 2: DESIGNING PROFESSIONAL C++ PROGRAMS
Your interviewer will want to make sure that in addition to knowing the C++ language,