Bloomberg LP Interview Question for Financial Software Developers






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

1. Can you have private destructor and private constructor ? explain your answer.
yes, like the realization of singlton

2. Can you have virtual constructor ? explain your answer.
No, at that time , the vtbl is not be constructed the function call will can't be the dynamic bound

3. What design pattern is similar to virtual constructor ?
abstract factory

4. Can you have vector of auto_pointer ? explain your answer.
no, it can 't be auto counted in STL container

5. is this code valid:
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());
most likely valid

- asuran October 13, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Dude this code doesn't compile

1 #include <stdio.h>
2
3 class A
4 {
5 A();
6 };
7
8 int main()
9 {
10 A x;
11 return 0;
12 }

- Anonymous January 07, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I have had similar experience with Bloomberg.
I wonder why they are so arrogant. The developers at Bloomberg claim to make a lot of money but they don't. And obviously they are not the most desirable company to work for for CS graduates.

- vodangkhoa May 01, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I had same experience with Bloomberg.
Very tuff people and very arrogant attitude.
Ready to turn you down at any cost.
I wonder why they waste everyone's time if they are ready to ask questions which they never used or never make sense to use in programming.
Salary what they offer is also very low compare to other financial institutes

- Nimesh May 07, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

5. is this code valid:
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());

I just check some reference(auto_ptr in STL). This code is invalid. One Object can only have one auto pointer.

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

for q5,

just check the book of c++ primer (4 edition) page 705, it is valid. when we set b = a, a point to null, and b point to the object which b originally point to.

- lensbo November 26, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

for q5: Should be "auto_ptr", not auto_pointer

- fakong December 06, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

q1: private destructor is used to prevent "creating pointer". private constructor is used by singleton.

- fakong December 06, 2008 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Q5, it should be valid.
a,b have their own ownership for two respective objects.

- hk February 04, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

there is a syntax error it should be auto_ptr

- Anonymous February 16, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Don't know if it is nice to ask the manager what is a real distributed system according to him....will him mind to share with you :)

- vanlanchoy November 08, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Don't know if it is nice to ask the manager what is a real distributed system according to him....will him mind to share with you :)

- vanlanchoy November 08, 2009 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This code does not compile:

#include <stdio.h>

class A
{
// A();
public:
virtual A();
};

int main()
{
A x;
return 0;
}

test-constr-private.cpp:7: error: constructors cannot be declared virtual

- Anonymous January 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

This code does not compile:

#include <stdio.h>

class A
{
// A();
public:
virtual A();
};

int main()
{
A x;
return 0;
}

test-constr-private.cpp:7: error: constructors cannot be declared virtual

- Anonymous January 07, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Q5.
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());
a = b;

It's invalid. The reason is as follows:

Notice however that the left-hand side object is not automatically deallocated when it already points to some object. You can explicitly do this by calling member function reset before assigning it a new value.
(from cplusplus_com)

In order to make it valid, we could change the code to

auto_ptr<Object> a(new Object());
auto_ptr<Object> b(new Object());
a.reset();
a = b;

- Q5 February 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Q5.
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());
a = b;

It's invalid. The reason is as follows:

Notice however that the left-hand side object is not automatically deallocated when it already points to some object. You can explicitly do this by calling member function reset before assigning it a new value.
(from cplusplus_com)

In order to make it valid, we could change the code to

auto_ptr<Object> a(new Object());
auto_ptr<Object> b(new Object());
a.reset();
a = b;

- Q5 February 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Q5.
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());
a = b;

It's invalid. The reason is as follows:

Notice however that the left-hand side object is not automatically deallocated when it already points to some object. You can explicitly do this by calling member function reset before assigning it a new value.
(from cplusplus_com)

In order to make it valid, we could change the code to

auto_ptr<Object> a(new Object());
auto_ptr<Object> b(new Object());
a.reset();
a = b;

- Q5 February 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Q5.
auto_pointer<Object> a(new Object());
auto_pointer<Object> b(new Object());
a = b;

It's invalid. The reason is as follows:

Notice however that the left-hand side object is not automatically deallocated when it already points to some object. You can explicitly do this by calling member function reset before assigning it a new value.
(from cplusplus_com)

In order to make it valid, we could change the code to

auto_ptr<Object> a(new Object());
auto_ptr<Object> b(new Object());
a.reset();
a = b;

- Anonymous February 05, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

reset is not needed. Here it clearly states "If the (left-hand side) object was being used to point to an object before the operation, the pointed object is destroyed (by calling operator delete)."
This can be verified easiler, just create a simply class and check if left side object is destroyed or not. See attached code

#include <string>
#include <iostream>
#include <memory>
using namespace std;
 
class A{
    string mName;
public:
    A(string name) { mName = name; }
    ~A(){  cout << "~A" << mName << endl;
    }    
};
 
 
main()
{
    auto_ptr<A> ap1(new A("p1") );
    auto_ptr<A> ap2(new A("p2") );
    ap1.reset();
    cout << "Here after reset" << endl;
    ap1 = ap2;
    cout << "Here after assignment" << endl;
}

- lxz December 12, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry.
Above code if you remove ap1.reset and the following cout statement, it works well and you will see output shows ap1 get destroyed right after ap1 = ap2.

- lxz December 12, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

class A
{
private:
	A(){};
	~A(){};
public:
	void I(){};					// Pseudo-constructor
	void D(){};					// Pseudo-destructor
};
...
	A *a = ( A * )malloc( sizeof( A ) );
	a->I();
	a->D();
	free( a );
...

- Sergey Kostrov November 03, 2014 | 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