Wall Street Programming Interview Questions zz

来源:百度文库 编辑:神马文学网 时间:2024/04/29 09:33:07
发信人: asker (suffer and survive), 信区: Programming
标  题: Wall Street Programming Interview Questions zz
发信站: 水木社区 (Tue Oct 31 00:11:20 2006), 站内
http://www.96bosses.com/content/view/23/33/
Contributors: Andrey Butov, experienced Wall Street programmers, and hiring
managers.
What follows is a list of interview questions for programmers applying for
work at Wall Street firms.
This is an ever-evolving document. New questions are added regularly.
Some of these questions I have asked myself when interviewing candidates
for various positions, and some of these appear in my book ‘So You Want To
Be A Wall Street Programmer‘ . Others are contributed by various Wall
Street programmers and hiring managers. If you have an interview question
that you would like to add, and you have actually asked or been asked this
question at a Wall Street interview, please contact me at
support@96bosses.comThis email address is being protected from spam bots,
you need Javascript enabled to view it .
General Reaction Questions ( all Wall Street IT positions )
What do you do if you have a situation where a bug shows up during normal
execution, but turns out to be impossible to reproduce when running under a
debugger, or when attempting to isolate it by inserting extra debug output?
Such bugs are sometimes referred to as ‘Heisenbugs‘, meaning that any
attempt to study or observe them changes their behavior. Please understand
that no matter what answer you give, I, as the interviewer, can always
augment the question to nullify your response. I‘m looking for two things
here: your ability to bring reason to a problem, and, hopefully, your
eventual admission that sometimes you have to put all those nice toys away,
and just eyeball the code to find the problem. All too often, people use
tools as crutches unnecessarily.
You‘ve just accepted a position at a company. One of your duties is to
manage the support lines for a few hours a day, and it just so happens that
a trader calls up screaming about a problem while everyone else is out of
the office. You‘re still new, and don‘t know anything about the problem.
You can‘t reach anyone by cell phone or any other method, and the trader is
getting more and more impatient. What do you do?
There‘s no right answer to this. If you insist that there is, you‘re either
fooling yourself, or you‘re just lying. There‘s no right answer to any such
situational questions, as I can always change the parameters of the
question. The goal is the same -- I want to get a glimpse of your thought
process.
General Programming Questions ( systems developer & application developer )
What could be the cause of the problem when a process dumps core and prints
out the message ‘pure virtual function called‘?
This often happens on Solaris machines -- but that‘s not very important.
What is important, is for me to get a glimpse into your thought process as
you mull over the problem. How can a pure virtual function be called in a
running process? Shouldn‘t the compiler catch any such attempts before you
even build the thing? Well, there are multiple causes for this, but I will
be really, really happy if your thought process leads you to explore the
possibility of a multi-threaded process, where a destructor is called on an
object in one thread, and another thread calls a method on the parent class
of something in the midst of being destroyed. Fun stuff, that C++, isn‘t
it?
Explain the concept of Copy on Write.
Developers of a certain caliber should be aware of some foundational
Computer Science concepts. While I‘m not interested in specific examples,
the concept of Copy on Write (COW) should not be foreign to a candidate
applying for a position as a trading system developer.
In a nutshell, Copy on Write is an optimization technique. When a resource
(usually memory) is being used by multiple clients, COW provides the
illusion that each client is using a distinct copy of a resource until such
time when one of the clients attempts to modify the resource. Until
modification is made, the resource is actually shared amongst the clients.
When modification is requested, a copy is made of the shared resource, and
(usually) the modifying client receives the new copy.
If a candidate is able to provide a few examples of common use of Copy on
Write in the field, some good ones would be memory management units in
virtual memory environments (Linux processes for example), or some common
implementations of the C++ std::string (although from what I remember, the
requirement of using COW in std::string implementations doesn‘t exist in
the standard).
It would also be nice to see if the candidate mentions some of the pitfalls
of using COW, such as multithreaded environments.
Several guests of 96bosses.com have submitted other answers for this, but
we cannot credit them since they have not signed up for an account here
(which is FREE), and thus we cannot disclose their names. If you do have a
good answer to this question, feel free to sign up for an account, and
contact us to submit your answer.
C++ Programming Questions ( systems developer & application developer )
Assume you have a class with 100 integer members. Would it be safe to do a
memset() on the object in order to quickly zero out the memory?
Everyone answers ‘no‘. Of course they do...the question is phrased in such
a way that you feel the answer should be ‘no‘. And it is. But why is the
answer ‘no‘? This one isn‘t situational. I really want the correct answer.
Specifically, I want to find out if you‘re aware of the existence of
virtual tables and vtable pointers -- and the understanding, that at some
point, someone might want to derive something from this class, and bring
one of these vtable pointers into existence without realizing that there is
a memset() hiding somewhere in the calling code.
When would you need a virtual destructor? (and if answered correctly, why
wouldn‘t you always use a virtual destructor?)
I never asked this silly question, until I began noticing that many
programmers lack a fundamental understanding of the issues involved.  Same
deal as with the memset() question above -- I want to see if you understand
the concept of virtual. You claim to know C++, so I fully expect you to
understand the language‘s most fundamental concept. Yes, you will leak
memory if you leave it out and delete an object through a parent pointer.
Yes, space is still at a premium, and yes, the virtual table pointer takes
up unnecessary space if it‘s not needed.
Reverse a character string.
This is a rather commonplace question, but I like it. You‘d be surprised
how many people can‘t answer this one. I blame it on the fact that colleges
no longer cover pointers, and prefer to focus on higher-level languages.
There is no getting away from pointers, and so, I always throw this or a
similar question on the table.
Write a one-liner to check if a number is a power of two.
There are many solutions to this, so I‘m only posting my favorite:
C++ solution: int is_power_of_two(int x) { return (x & (x - 1)) == 0; }
Of course, this incorrectly reports zero as being a power of two, so a more
accurate solution would be:
int is_power_of_two(int x) { return (x > 0) && (x & (x - 1)) == 0; }
... and yes, I know I should have returned a bool instead of an int, but
this is just how it is. I also write 0x00 instead of NULL in most of my
code.
Many 96bosses.com members submitted correct answers to this question.
Anindya Mozumdar was the first.
When must you use an initialization list?
Contact us to submit a good answer for this question.
Why is the parameter to a copy constructor passed by reference?
Contact us to submit a good answer for this question.
Explain virtual inheritance.
Contact us to submit a good answer for this question.
Why shouldn‘t you throw an exception inside a destructor?
Many folks submitted answers for this question. Josh McFarlane submitted
the most lucid explanation.
When you throw an exception, all of the current scope objects are popped
off the stack, causing their destructors to be executed. This means that it
is possible for your destructor to be called while an exception is already
being handled. If you throw another exception while the system is trying to
handle the current exception the program cannot handle both without losing
information, and by default terminates the program.
Why would you use the volatile qualifier?
Contact us to submit a good answer for this question.
Why would you use the explicit qualifier?
Contact us to submit a good answer for this question.
What can the statement delete this in a destructor be harmful?
Contact us to submit a good answer for this question.
Why is it a bad idea to write using namespace ... in a header file?
Contact us to submit a good answer for this question.
How can you access command line arguments inside the code?
Contact us to submit a good answer for this question.
How can you access environment variables inside the code?
Contact us to submit a good answer for this question.
--
※ 来源:·水木社区 newsmth.net·[FROM: 61.233.7.*]