Bloomberg LP Interview Question for Software Engineer / Developers






Comment hidden because of low score. Click to expand.
0
of 0 vote

Re: Question 3

If this is C++, the function definition, as written, does not appear as though it would even compile. There are no argument lists, functionName has no return type, is defined improperly (function blocks are not terminated by semi-colons), and functions must be defined outside all other functions.

Why would they ask something like this?

- Susan April 22, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Re: Question 4

It depends whether depth refers to the number of links or the number of nodes on paths from root to leaf. If depth(T) := numLinks(path(root(T), maxleaf(T)) = 10, then it is 2^10 or 1024.
Otherwise, if depth(T) := numNodes(path(root(T), maxleaf(T)) = 10, it is 2^9 or 512.

Re: Question 5

A void pointer can easily be converted to an integer pointer ([unsigned/signed] [long/short] int*) through static casting.

e.g. void* vp = malloc(100);
int* ip = (int*) vp;

In C++, C-style casting can be avoided, and so the following is preferred:
int* ip = static_cast<int*>(vp);

- Susan April 22, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Sorry my bad....

Question 3 again....

class example
{
int bytes;
virtual functionName{ };
}

How much memory will this class take?

I was asked this question after talking about virtual tables....
The answer is that the int would require 4 bytes and since the virtual function contains a pointer to the virtual table for this class, it would require another 4 bytes for storage of this pointer plus some bookkeeping information.

- Sach April 22, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The VTBL pointer you're refering to is named something like vptr in C++. Every abstract data type object(class containing at least 1 v.f.) contains it in memory. I'm not sure if this is what you meant. Seemed like, based on your explanation, that a vptr is created for every virtual func.

- Jack April 22, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I will presume you meant something like this.

class example
{
int bytes;
virtual void functionName();
};

int's generally require 4 bytes, on most machines. However, some legacy systems still only allocate 2 bytes for an int. C++ only requires that sizeof(char) <= sizeof(int), so theoretically, implementations could vary this quite a bit.

Otherwise, it seems okay.

- Susan April 22, 2006 | Flag Reply


Add a Comment
Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

Learn More

Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.

Learn More

Resume Review

Most engineers make critical mistakes on their resumes -- we can fix your resume with our custom resume review service. And, we use fellow engineers as our resume reviewers, so you can be sure that we "get" what you're saying.

Learn More

Mock Interviews

Our Mock Interviews will be conducted "in character" just like a real interview, and can focus on whatever topics you want. All our interviewers have worked for Microsoft, Google or Amazon, you know you'll get a true-to-life experience.

Learn More