Bloomberg LP Interview Question for Financial Software Developers






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

Right.

The exact statements would be -

1) gets created on the heap.
2) gets created on the stack.

Both will have their default ctors called.

- xankar June 23, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Well, if I remember right, objects are always created on heap. Correct me if i am wrong

- Huangxinyu June 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

your answer is right but in both the cases memory will be created on heap only. But second one is object so memory will be cleared when it will go out of scope where as in first case memory must be manually cleaned.

- Harit June 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

So when do objects go on the stack?

- Xankar June 28, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

Objects are always created on HEAP .... check the book "Thinking in C++" ...

- Aditya Kuamr Verma September 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

this is not freaking java

- anonymous May 10, 2015 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I told him that they both called the default ctor. But the first one is dynamic allocating the memory which needs to be deleted manually. And you don't have to delete the memory for the second one. Any comments?

- Huangxinyu June 22, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I agree with xankar
1) gets created on the heap.
2) gets created on the stack.

- Anonymous July 01, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Objects are always created on HEAP .... check the book "Thinking in C++" ...

- Aditya Kuamr Verma September 23, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Xankar is correct, Harit, you already supported this by saying the obj mem goes out of scope in 2nd case. That itself means that it is the stack mem.

- Raaj July 03, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Yes, that's correct.
new() returns memory from heap and local variables of functions gets created on stack.
Memory allocated on heap will remain there until user calls delete,but variables created on stack gets destroyed as the function becomes out of scope.

- ashgarg July 24, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Objects are always created on HEAP??? are you crazy?

- Anonymous October 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

he is from javaland i guess

- nk October 02, 2011 | Flag


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