Bloomberg LP Interview Question for Financial Software Developers






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

Here i forgot the part mentioned in the main , but i think it was some thing like String s = "asas";

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

It will compile... it will even run if you put the declaration:
String s = "asas"
in the main program. However, since the constructors and assignment operator are empty and there is no storage associated with the class, no data will ever be associated with the class which makes it of very questionable usefulness.

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

Its tricky. The constructor is declared as explicit. So declarations of the form String s ="asas"; may be illegal.
However the explicit constructor's parameter list has only a char ch and not a character array, which the non-explicit constructor has (char *p), so in this case String s ="asas" should compile.

- p March 01, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

If the 2 constructor was not declared to be explicit then the code will not compile. The reason for that is the call to the constructor will be ambiguous.
Now when the 2 constructor is declared explicit the ambiguity is removed when we declare objects of the type string s1= "abc".
Ambiguity still exists when object is created this way
string s1("abc")
google "c++ explicit" for the reason, I am unable to post link to the web page

- abhimanipal May 06, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

However the assignment operator is private. Iam not sure whether calling String s="asa" in main() would compile.

- Musheka March 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

My apologies for the previous answer. For a moment I forgot that "copy constructor" is called when you create a string like string s = "asas"

- Musheka March 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

try these

String s = "ddas"; // OK it calls "String(const char *p){} "

String s1 = 'd'; // error should explicitly call the ctor

String s2 ('d'); // OK

- Mostafa April 26, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Yes

- Anonymous May 25, 2021 | 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