Goldman Sachs Interview Question for Applications Developers


Country: United States
Interview Type: Phone Interview




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

Out put will be
"sum of class b"
its general mechanism of virtual function...

- Kuber April 09, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote

This is a typical problem when pointer of the based class points to an object of the derived class. In this kind of problem, if the called function has been overridden by the derived function, the pointer will call its derived function. Thus the output is: "sum of class b"

- Zhangquan1987 May 17, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Is it allowed to use the same variable name as the Class name?

- Harsh April 09, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 votes

yes u can use same name for variable and class name.

- nipun July 01, 2013 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 vote

It does not give any error instead it prints "sum of class b". I have executed the code. Compiled the code in g++-4.2.1.

- Anil April 10, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Error : As class name is same as member variable

- Rohit April 24, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Typical virtual function example. Output:sum of class b

- pankaj April 27, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

No error, typical virtual function eg.
output-
sum of class b

- nipun July 01, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

erroe....We cannot give class name and class variable same identifier(name)..
error C2380:

- ritesh August 14, 2013 | Flag Reply
Comment hidden because of low score. Click to expand.
-1
of 1 vote

[Error] cannot convert 'B*' to 'A*' in assignment.

- flipper April 09, 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