Bloomberg LP Interview Question for Software Engineer / Developers






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

double s[2]; //if we want to find the size of double
int diff=((char*)&s[1])-((char*)&s[0]);

- Vinod September 09, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

3)In C++ , when you create and object and do not destroy after its scope is over, the memory occupied by the object is not freed(As the allocation of memory in C++ is on stack). THe memory in RAM which is occupied is not available for other application . AS the program is run over and over again .more and more memory becomes captive.. thus leaving no memory to run any further application . This leads to a crash . It is equivalent to memory slowly and steadily being leaked out to this application a phenomenon analogous to water container leakage ..hence the name .. Memory Leak

- purose September 12, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Hey, purose.. ur explanation is correct except the fact that when memory is allocated using "new()" operator, it is allocated on heap and will not be freed until released with "delete",even if the variable goes out of scope... :)

- Regs September 12, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

1. sizeof int can be 4 or 2. Compiler dependent
3. I used lcint to perform static code checking for memory leak
4. When it's created by new(), it's in free store, not in heap.

- Yang November 11, 2006 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Just a question guys, wouldn't memory get freed when the program stops?

- DrEvil March 07, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

free store is also called dynamic memory or the heap.

- lvv June 02, 2007 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes! Each process has an address space. When the program exit, that piece of memory now becomes Free.

- vodangkhoa March 07, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Not always. A program might exit but the memory is still wasted.

- Bibhu Mohapatra October 11, 2007 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

memory leaks happen for running servers/processes. Whenever a process ends, its address space and allocated memory for it is freed. Say a server process is running, usually it forks other server process to interact with clients. in case every process is having a memory leak, then finally we need to kill the parent process, in order to free up the resources.

You can confirm this on windows using task manager and on linux using top command.

- ked February 27, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Size of a variable without using sizeof

#include <iostream>

class A
{
public:
int _x;
double _y;
long _z;
};

int main()
{
A a;

//std::cout << sizeof(a) << std::endl;

int diff_x = reinterpret_cast<long>(&a+1) - reinterpret_cast<int>(&a);
int diff_y = (char *)(&a+1) - (char *)(&a);

std::cout << diff_x << std::endl;
std::cout << diff_y << std::endl;
}

- Sudar October 08, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 0 vote

5) How will you determine the size of an variable without using sizeof operator ?

int * p;
double *q;
p=0;
q=0;
printf("%u, %u",p++,q++);
will give you size of integer and double

- CyberPhoenix November 20, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

You need the prefix increment versions.

- Anonymous January 03, 2010 | 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