C/C++/STL/Unix Programmer Question and Answers
C++
Basic Syntax
What is the difference between pointer and reference?
Pointer and reference hold memory address as their values. The address of the reference is the address of the aliased object, and the value of the pointer is the address of the pointed object. Pointer can point to different objects during its lifetime or NULL. [...]
Sample Programmer Interview at Ion
1) Count number of binary “ones” in a sentence
int numOnes(string word) {
int length = strlen(word);
int count = 0;
for (int i = 0; i > 1;
[...]
Sample C++ Programmer Interview Questions and Answers from Goldman Sachs Equity Platform Tech
The phone interview questions can be found at www.careercup.com. Below are the on-site questions.
Show me how virtual function works in C++
class base{
public:
virtual void foo(){}
};
class derived: public base{
public:
void foo(){}
};
base * a, *b;
a = new base();
a->foo() // Calls base’s foo()
b = new derived();
b->foo() [...]
Typical Phone Interview Q&A
Below are a reference for typical interview Q&A. The programming Q&A will be posted later.
C
What is the difference between new/delete and malloc/free?
Malloc/free do not know about constructors and destructors. New and delete create and destroy objects, while malloc and free allocate and deallocate memory.
The differences between static, volatile and automatics
Static variables are given space [...]


