Online Book Reader

Home Category

Professional C__ - Marc Gregoire [498]

By Root 1432 0
can be used to convey metainformation.

The principle of decomposition

The principle of refactoring

Naming techniques

Types of Questions

Style questions can come in a few different forms. One of the authors was once asked to write the code for a relatively complex algorithm on a whiteboard. As soon as he wrote the first variable name, the interviewer stopped him and told him he passed. The question wasn’t about the algorithm; it was just a red herring to see how well he named his variables. More commonly, you may be asked to submit code that you’ve written, or to give your opinions on style.

You need to be careful when a potential employer asks you to submit code. You probably cannot legally submit code that you wrote for a previous employer. You also have to find a piece of code that shows off your skills without requiring too much background knowledge. For example, you wouldn’t want to submit your master’s thesis on high-speed image rendering to a company that is interviewing you for a database administration position.

If the company gives you a specific program to write, that’s a perfect opportunity to show off what you’ve learned in this book. How many other candidates will include unit tests with their program, or extensive comments? Even if the potential employer doesn’t specify the program, you should consider writing a small program specifically to submit to the company. Instead of selecting some code you’ve already written, start from scratch to produce code that is relevant to the job and highlights good style.

Also, if you have documentation that you have written and that can be released, meaning it is not proprietary, use it to show your skills to communicate, it will give you extra points. Websites you have built or maintained, articles you have submitted to places like CodeGuru, CodeProject, SourceForge, and so on, are very useful; it says you can not only write code, but you can communicate to others how to effectively use that code. Of course, having a book title attached to your name is also a big plus.

CHAPTERS 6 AND 7: CLASSES AND OBJECTS

There are no bounds to the types of questions you can be asked about classes and objects. Some interviewers are syntax-fixated and might throw some complicated code at you. Others are less concerned with the implementation and more interested in your design skills.

Things to Remember

Basic class definition syntax

Access specifiers for methods and data members

The use of the this pointer

How name resolution works, which resolves a name first by local scope, then class scope (implying this->) and then global scope

Object creation and destruction, both on the stack and the heap

Cases when the compiler generates a constructor for you

Constructor initializers

Copy constructor and assignment operator

The mutable keyword

Method overloading and default parameters

Friend classes and methods

Managing dynamically allocated memory in objects

static methods and members

Inline methods and the fact that the inline keyword is just a hint for the compiler which can ignore the hint

The key idea of separating interface and implementation classes, which says that interfaces should only contain public methods, and should be as stable as possible; they should not contain any data members or private/protected methods; thus, interfaces can remain stable while implementations are free to change under them.

C++11 initializer lists

C++11 in-class member initializers

C++11 explicitly defaulted and deleted special member functions

Types of Questions

Questions such as, “What does the keyword mutable mean?” make great phone screening questions. A recruiter may have a list of C++ terms and will move candidates to the next stage of the process based on the number that they get right. You may not know all of the terms that are thrown at you, but keep in mind that other candidates are facing the same questions and it’s one of the few metrics available to a recruiter.

The find-the-bug style of questions is popular among interviewers and course instructors alike. You

Return Main Page Previous Page Next Page

®Online Book Reader