free hit counter

Wednesday, October 12, 2005

missed interview questions

I had a quality phone interview yesterday. It lead off with a ranking of some skills from 1-10, (10 being Stroustrop for C++), then some technical questions based on those answers.

Dead on missed:
describe C++ const methods
const methods are methods that are guaranteed not to modify the members of the class. They are the only methods you can call on objects declared const, but are more usefull as compiler enforced check on methods that should be "read only".

in C++ what is the mutable keyword used for
Used on member declarations in a class declaration, allows a data member to be modified even if an instance is declared const.

besides classes and inheritance, name 5 differences between C and C++
ones I came up with on my own once I was out of the spotlight:
* exception handling
* don't have to declare variables all in one block at the top of a new scope
* new and delete
* operator overloading
* changed headerfile naming
* iostream instead stdio
* templates
* STL
* need extern "C" {} construct for intermingling with C

Ones I researched after the fact:
* C++ requires prototypes
* in C++ f() declares a function that takes no parameters. In C, a function declared using f() can be passed an arbitrary number of parameters of arbitrary types
* sizeof('x') is equal to sizeof(char) in C++ but is equal to sizeof(int) in C
* C++ puts structure "tags" in the same namespace as other names, whereas C requires an explicit struct. e.g., the typedef struct Fred Fred; technique still works, but is redundant in C++

Update with a rather definitive website:
http://david.tribble.com/text/cdiffs.htm

0 Comments:

Post a Comment

<< Home