Goldman Sachs Interview Question for Applications Developers


Country: India




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

How about writing extension methods for string type?

static class StringExtensions
{
public static string CustomConcat(this string s, string s2)
{
return string.Concat(s, s2).ToUpper();
}
}

static void Main(string[] args)
{
string s = "abc";

s = s.CustomConcat("def");
}

- siva November 22, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

@siva: extension is not feasible.
@andi: how about using reflection?

- The Artist November 23, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

how can we give new definition using reflection?

- Andi November 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Can we override String class methods, we can create a new method for the concat function but interviewer asked for String's class concat method, we cannot do so as it is final. We cannot either overried any method or extend the class itself.

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

we can override toString() method to give new implementations to the method as String conversions are implemented through the method toString()

- Sandeep March 13, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

I think it about defining your library with same name and putting it in path variable before system library. Thus reference for Sting class is resolved with your new library and not system old library.

- spa March 22, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

If you can use boost:
boost::to_upper_copy(s1+s2);

or use std::toupper(int); this way you have to go through the string char by char.

- Anonymous May 15, 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