Interactive Brokers Interview Report
- 0of 0 votes
AnswersYou have a class that many libraries depend on. Now you need to modify the class for one application. Which of the following changes require recompiling all libraries before it is safe to build the application?
- Anonymous July 31, 2010
a. add a constructor
b. add a data member
c. change destructor into virtual
d. add an argument with default value to an existing member function| Report Duplicate | Flag | PURGE
Interactive Brokers C++ Object Oriented Design - 1of 1 vote
Answersmemset is sometimes used to initialize data in a constructor like the example below. What is the benefit of initializing this way? Does it work in this example? Does it work in general ? Is it a good idea in general?
- Anonymous July 31, 2010
class A {
public:
A();
private:
int a;
float f;
char str[35];
long *lp;
};
A::A()
{
memset(this, 0, sizeof(*this));
}| Report Duplicate | Flag | PURGE
Interactive Brokers C Coding - 0of 0 votes
AnswersYour task is to implement the Reduce function using templates. The Reduce fn applies a function of two arguments cumulatively to the items of an STL container, from begin() to end(), so as to reduce the sequence to a single value. For example, Reduce(<list containing 1,2,3,4,5>, std::plus<int>()) should calculate ((((1+2)+3)+4)+5).
- Anonymous July 31, 2010
class NotEnoughElements {};
template <typename Container, typename Function>
typename Container::value_type
Reduce(const Container& c, Function fn) throw (NotEnoughElements)
{
Fill here
}| Report Duplicate | Flag | PURGE
Interactive Brokers C++