Bloomberg LP Interview Question for Software Engineer / Developers






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

It is E because: It increases compile time dependency because lets say the component A has an inline function which component B is using. If the function changes, since the function is inline(the function is sitting in the binary of B); B needs to be recompiled as well. If it was an ordinary function, it could have just been linked.

- sudarshan.fs August 27, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think it should be (e)

- Coder August 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
-2
of 2 votes

Answer is A

- Harit August 16, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

this type of question is boring.

it can't make the program SLOWer, BTW....

- beyondfalcon August 16, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

i think it is possible... abusing inline function will cause excessive code replacement -> bigger executable -> program too big that it cannot fit in the memory -> memory swap -> ultimately thrashing. slight chance this will happen but still possible...

- syrus August 17, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

it is E
see this h***://w**.mpi-inf.mpg.de/~kettner/courses/lib_design_03/notes/large.html#Insulation

- Ramesh August 21, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

h**p://w**.parashift.com/c++-faq-lite/inline-functions.html#faq-9.3

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

answer is E....
because once I was asked a similar question in my interview at bloomberg...Though I couldn't answer the question on spot..I found it later....But, the question was no so straight forward...

- T August 17, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

How can it be E?
Doesn't inline just copy the code whenever the function is invoked. So if anything, compile time is quicker.

What might be slower is the act of looking up where the inline function is to do the code copy. -- But that's not really a compile-time dependency. It's more of a compiler implementation issue.

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

I think D

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

It not D

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

It depends on compiler. So the answer is f) - non of above

- HёLL August 24, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is (d) folks.

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

Not d. According to Herb Sutter, once and again chairman of the C++ standards committee, in his book 'Exceptional C++ Style', pg 192, he says: "The inline keyword is not required to have any semantic effect on a C++ program. It doesn't affect other parts of the standard language, in that writing inline on a function does not change how you use the function (for example, /you can still take the function's address/).. ". (Emph. mine.)

- JeffD September 13, 2010 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

It's E because the compiler has got to have the definition of the inline function available in the same translation function - its obvious why, I hope.

- 10098 September 15, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

It is D. When making inline, code replacement will take place. When code replaced all the place, why to still keep the function in code segment. And when no function, how would one take address of the function.

Not E. --> It would increase dependency (e.g. what if function defined in separate compilation unit). But is that a disadvantage. After all we are more worried about the runtime of program even if it comes at some extra effort at compile time.

Regarding the comment mentioning that program might get slower. --> Swapping, Thrashing and all ....but its chances of making it slower as compared to the reduced time in saving function calls would be very very less

- vipin September 18, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Answer: A
http: // msdn.microsoft. com/en-us/library/z8y1yy88%28v=VS.80%29.aspx
"Inline expansion alleviates the function-call overhead at the potential cost of larger code size."

- blueskin.neo November 21, 2010 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Answer is E

- Nandha March 04, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

its A....
wherever the compiler finds a call to an inline function, it writes a copy of the compiled function definition. so, execution time reduces but their is a trade-off with the memory. As memory requirement increases.

The reason C++ has inline functions and macros is to eliminate the overhead incurred by function calls. However, the tradeoff of this is the fact that the program size increases with both macros and inline functions.

Therefore the answer is A

- sumit.sh.133 March 17, 2013 | 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