C++ ICE mkt-data – some of the more difficult questions

Q: you said you write code on Windows, but production platform is linux, so how do you test your code?
Q: difference between a C struct and a C++ struct?
Q: have you used memory leak detectors?
Q: How do you link c and c++ code? dlopen()?
Q: have you used memory leak detectors?
Q: scope resolution operator?
Q: default constructor?

Q: what other things are synthesized?
%%A: dtor, copier, op= but c++11 add some move operators
A: indeed, c++11 would synthesize 1) move ctor and 2) move-assignment operator under strict conditions. See http://stackoverflow.com/questions/3734247/what-are-all-the-member-functions-created-by-compiler-for-a-class-does-that-hap

Q: given template<typename T> void f(T a, T b), can f(3, 0.8) compile?

Q: how do you use gdb to view a core file?

Q: write a sqrt(int) function without using the math library.  Estimate to 0.01 precision.

Q: UDP vs TCP?
A: virtual circuit. Single remote socket. In contrast UDP can send to multiple receivers efficiently – broadcast or multicast. A: transmission control, with data loss prevention

Q: what’s wrong with multiple inheritance? How do you deal with it?
%%A: diamond problem. I don’t use virtual inheritance. I use MI when base class is an interface without any field.

Q1: how do you create a thread in c++?
A: std::thread is RAII so the constructor starts the thread, and the dtor must run after joining or detaching.

Q1b: Have you used posix_thread?
A: it’s a c library, so no constructor magic. Probably some pthread_something() function. Correct! pthread_create()

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s