Goldman Sachs Interview Question Analysts




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

Two types of argument passing in a function:
Call by reference pass the address of the variable, thus it changes the actual value of the variable, even outside the function.
Call by value passes the copy of the variable, thus it doesn't change the actual value of the variable.

- shekhar2010us on February 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Also, they are different in C and C++! Find out!

- rajendra on February 10, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

REFERENCE IS NOTHING BUT AN ALIAS OF THE OBJECT
IN PASS BY REFERENCE THE ARGUMENT CAN CHANGE
THAT WHICH WILL AFFECT THE OUTSIDE.

- BHARANI on March 10, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

Mr. Shekhar, Reference is not by address. BTW address is nothing but pass by value. For pass by Reference compiler shares reference of the variable. It is NOT address.

- Anonymous on March 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

Sorry but Shekhar got the right answer.
Not sure why your complaining with invalid fact.

By value will send a copy of the original value/object thus the value/object isn't modified outside of the scope of the function.
By reference will send a reference of the value/object to the function and every modification made in the function are reflected to the variable/object outside of the function.

You pass value by reference when you pass the address to the function, even though the compiler // language does it for it, that how it done.
If you give an array, by default they pass those by reference for performance issue, your language / compiler does have default setting to pass some object type by reference or values.

though everything passed by reference, it send the address at which the variable/object is located outside the scope of the function, as to by value it doesn't pass an address but rather the raw value or duplicate the object and send the address of the new object copy...

Go learn more assembler, the compiler share by reference the address, your not making in sense in that reply.

- Anonymous on February 23, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

informit.com/guides/content.aspx?g=cplusplus&seqNum=166

- Anonymous on March 17, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Making a variable name in a function an alias for a variable in the calling program. This method of passing arguments is called passing by reference. Passing by reference allows a called function to access variables in the calling function. C++’s addition of the feature is a break from C, which only passes by value. Passing by value, recall, results in the called function working with copies of values from the calling program.

- arlington on January 24, 2014 | Flag Reply


Add a Comment
Name:

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

Books

is a comprehensive book walking you through 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