Bloomberg LP Interview Question for Software Engineer / Developers


Country: United States
Interview Type: In-Person




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

empty class size is 1.

- kbhaskarkotha March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

Wasn't the question "how much space get's allocated?" rather than what is sizeof(C)?

- ichiban July 18, 2012 | Flag
Comment hidden because of low score. Click to expand.
3
of 3 vote

The size of empty class is always One . This is because the compiler insert a char, anyhow he need a memory address to identify a class

- Atul Rain April 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Right Answer

- Anonymous November 16, 2014 | Flag
Comment hidden because of low score. Click to expand.
2
of 4 vote

The following methods are generated:

class C
    {
        C();
        ~C();
       C(const C & );
       C& operator = (const C &);
       C&  operator *();
       C* operator &();
};

- Anonymous March 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Compiler will create thee methods when they are used. Here, none of these method is used. Are they still created right after "class C{}; "?

- rockycharm November 10, 2013 | Flag
Comment hidden because of low score. Click to expand.
2
of 2 vote

class C
{
1) A default constructor
C();

2) A default destructor
~C();

3) A copy constructor
C(const C & );

4) A copy assignment operator
C& operator = (const C &);

};



plus

C* operator &();
const C* operator &() const;

- Joanna8848 January 16, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

no space will get allocated

- Anonymous March 15, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

I believe this is correct because the code snippet given defines the class C but does not instantiate it. No space is allocated.

- jazcap53 October 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
1
of 1 vote

jazcap53 is wrong.

- Anonymous November 16, 2014 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

The following methods are generated:

class C
    {
        C();
        ~C();
       C(const C & );
       C& operator = (const C &);
       C&  operator *();
       C* operator &();
};

- Anonymous March 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

The following methods are generated:

class C
    {
        C();
        ~C();
       C(const C & );
       C& operator = (const C &);
       C&  operator *();
       C* operator &();
};

- Anonymous March 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Empty class size = 1
There aren't any methods created.

- Kvasir March 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class C{};

C* pc = new C;
int n = sizeof(C);
n = sizeof(*pc);

I don't know why but n was 1.
Still the member methods are created and they are not counted as a size.

- moiskim March 28, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

that is min the c++ compiler allocates the memory for the class, if it doesn't have any member variables

- Murali muppireddy April 05, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

compiler insert a char for blank class, for it needs a memory address.
member functions aren:t be put in object.

- alex April 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

compiler insert a char for blank class, for it needs a memory address.
member functions aren:t be put in object.

- alex April 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

compiler insert a char for blank class, for it needs a memory address.
member functions aren:t be put in object.

- alex April 13, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

class C
{
C();
~C();
C(const C & );
C& operator = (const C &);
C* operator &();
const C* operator &() const;
};

- Anonymous September 21, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Compiler generates by default
1)A default constructor
2)A copy constructor
3)A copy assignment operator
4)A destructor

- wizard September 23, 2012 | 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