Bloomberg LP Interview Question Software Engineer / Developers

  • bloomberg-lp-interview-questions
    0
    of 0 votes
    17
    Answers

    Given the following definition:

    class C{};

    How much space gets allocated?
    What methods get created?

    - ddg on March 14, 2012 in United States Report Duplicate | Flag
    Bloomberg LP Software Engineer / Developer C++

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 on March 14, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

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

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

The following methods are generated:

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

- Anonymous on March 17, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
2
of 2 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 on April 20, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 2 vote

no space will get allocated

- Anonymous on 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 on October 23, 2012 | 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 on 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 on 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 on 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 on 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 on 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 on 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 on 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 on 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 on 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 on September 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 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 on January 16, 2013 | Flag Reply


Add a Comment
Name:

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

Books

is a comprehensive book walking you through every aspect of getting a job at a top tech company, while focuses on software engineering interviews.

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