Serving the Quantitative Finance Community

 
User avatar
Towelie
Topic Author
Posts: 0
Joined: August 14th, 2003, 2:26 am

C interview questions/preparation

December 19th, 2003, 1:38 pm

Did a search and found some posts on C++, how about C? Any typical questions? Any good books?Thanks.
 
User avatar
MattF
Posts: 6
Joined: March 14th, 2003, 7:15 pm

C interview questions/preparation

December 19th, 2003, 2:02 pm

What's a virtual destructor? Why/when would you use one?
 
User avatar
MattF
Posts: 6
Joined: March 14th, 2003, 7:15 pm

C interview questions/preparation

December 19th, 2003, 2:02 pm

Oh sorry - you wanted C? Just read Kernighan and Ritchie. But no-one tests for C any more do they?
 
User avatar
andE
Posts: 0
Joined: March 13th, 2003, 5:45 am

C interview questions/preparation

December 19th, 2003, 2:13 pm

we use a virtual destructor to enable an instance of a derived class to be deallocated through a base class reference.often, you will want to keep track of an object by a pointer, where the pointer type is that of the objects base class, rather than its own class.(this is a useful way of achieving polymorphism)Since the pointer could plausibly be referring to several different derived types, we need a virtual destructor to make sure the right destructor is called when you want to delete the object.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

C interview questions/preparation

December 19th, 2003, 5:58 pm

how would u write an integration function so that it can be used to integrate any mathematical function ? (assuming u have some numerical integration scheme).
knowledge comes, wisdom lingers
 
User avatar
Towelie
Topic Author
Posts: 0
Joined: August 14th, 2003, 2:26 am

C interview questions/preparation

December 19th, 2003, 6:09 pm

QuoteOriginally posted by: quadraturehow would u write an integration function so that it can be used to integrate any mathematical function ? (assuming u have some numerical integration scheme).Monte Carlo? Sample randomly and take average?
Last edited by Towelie on December 18th, 2003, 11:00 pm, edited 1 time in total.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

C interview questions/preparation

December 19th, 2003, 6:49 pm

i did say assuming u had a scheme... the scheme is not about which scheme but how would u implement a C function such taht it can be used for any function f(x) ?
knowledge comes, wisdom lingers
 
User avatar
QwertyYuiop
Posts: 0
Joined: October 10th, 2003, 7:39 pm

C interview questions/preparation

December 19th, 2003, 6:56 pm

QuoteOriginally posted by: quadraturehow would u write an integration function so that it can be used to integrate any mathematical function ? (assuming u have some numerical integration scheme).A pointer to a function as an argument in your integration scheme.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

C interview questions/preparation

December 19th, 2003, 6:57 pm

correct
knowledge comes, wisdom lingers
 
User avatar
eredhuin
Posts: 3
Joined: July 14th, 2002, 3:00 am

C interview questions/preparation

December 26th, 2003, 11:40 am

You can also integrate (or optimize for that matter) using templates with a functionoid class. I use operator()() overloading to provide function valuation, without ever resorting to pointers to functions. Note this contributes to code bloat.
 
User avatar
daveangel
Posts: 5
Joined: October 20th, 2003, 4:05 pm

C interview questions/preparation

December 26th, 2003, 12:03 pm

U can do that in C ? I am impressed
knowledge comes, wisdom lingers
 
User avatar
jimt
Posts: 0
Joined: November 11th, 2003, 7:48 am

C interview questions/preparation

December 28th, 2003, 2:48 am

Try Alan Feuer's "The C Puzzle Book". The code is not elegant, but that is not the point of this book.I doubt you'll be getting many straight C questions, if any at all.For C++ once you've been coding for a while, try reading Coplien's "Advanced C++" (referred to as 'The Purple Book'). A warning here, this is an ugly piece of work. There are some real gems in there if you take the time to absorb the material, but Coplien just cannot write (IMHO). He is a very bright man, but can take a leaf out of Rennie and Baxter's book (pun intended) with respect to clarity in writing. Then again, it is called "Advanced C++". I doubt you'll get any questions from that.Stan Lippman's "Inside the C++ Object Model" will give you an idea of what is happening under the hood. Although that book is probably a little dated now, and Lippman worked on the original C-Front iimplementation, but most should still be applicable.My advice in C++ would be to be read Scott Meyers "Effective C++" and "More Effective C++" books, and know STL (I believe Meyer's now has a book called "Effective STL", although I used the book by Musser and Saini).Cheers, J.
Last edited by jimt on December 27th, 2003, 11:00 pm, edited 1 time in total.