Goldman Sachs Interview Questions
- 0of 2 votes
AnswersIf we have unsorted list of numbers like
- java.interviews.questions September 11, 2013 in India
3,1,4,7,9,4,7,4,9
best way to figure out if number n exists in the list? they were interested in constant time performance| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer - -1of 1 vote
AnswersRemoving duplicates from unsorted list of integer?
- java.interviews.questions September 11, 2013 in India
if you have unsorted list of
0,5,9,5,6,7,6,9
the result should be
0,5,9,6,7 and the performance should be best over more number of elements.| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Algorithm - 0of 0 votes
AnswersHow to create singleton class and what if the constructor is throwing IOException? what will be best strategy to create instance of this class?
The question is more on constructor throws exception.
- java.interviews.questions September 11, 2013 in United States//create singleton class. private SingltonExample() throws FileNotFoundException { File f = new File("data.txt"); FileInputStream fis = new FileInputStream(f); }
| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - 1of 1 vote
Answersexplain if this method is thread safe?
- java.interviews.questions September 11, 2013 in United Statespublic static void myMethod(StringBuilder sb){ // StringBuilder is not thread safe.. }
| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer - 1of 1 vote
AnswersDescribe the design of a low latency distributed environment where multiple processes( or threads) need to access shared data structure or a database for a fast ( speaking of a fraction of a milisecond) read or update. You have to process tons of request very quickly ( you can think of market price data as an example, etc). How would you build such an environment in the most efficient way? Describe the solution in details(a few sentences).
- curious September 06, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Senior Software Development Engineer Computer Architecture & Low Level - -3of 5 votes
AnswersIf you have a 10G file and only 2G of memory, how can you fit the file into the memory. Describe the solution and write the code.
- curious September 03, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Problem Solving - 0of 0 votes
AnswersFind the expectation value of number of times you need to pick numbers to find a number smaller than the number you pick from a hat containing 1 to n.
- shravya.nitk August 22, 2013 in United States for Strats division
case 1: if you replace
case 2: if you don't replace
Expectation values! not probability| Report Duplicate | Flag | PURGE
Goldman Sachs Analyst Probability - 3of 3 votes
AnswersA standard chess knight (it moves in its standard way i.e. L shaped OR 2.5 moves) is sitting at the position a1 on an N x N chess board. What is the minimum number of moves it will take to reach the diagonally opposite corner?
- Saurabh Singhal August 17, 2013 in India
P.S. - If it were a 8 x 8 chess board, the final destination for the knight would be h8| Report Duplicate | Flag | PURGE
Goldman Sachs Intern Algorithm Coding Data Structures Trees and Graphs - 1of 1 vote
AnswersA young girl counted in the following way on the fingers of her left hand. She started calling the thumb 1, the index finger 2, the middle finger 3, the ring finger 4, the little finger 5, then reversed direction calling the ring finger 6, the middle finger 7, the index finger 8, the thumb 9 then back to the index finger for 10, the middle finger for 11, and so on. She counted up to n (to be input by the user). She ended on her which finger?
- Saurabh Singhal August 17, 2013 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Intern Problem Solving - 0of 2 votes
AnswersDLL contains N nodes of string data in each node...how you will find the combined string of the nodes is Palindrome or not....?
- advha August 16, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Software Analyst C++ - -1of 1 vote
AnswersIf i create 50 Base Class objects and 50 Derived class Objects, then 50 Base Class Virtual Pointers and 50 Derived class virtual pointers created or Static virtual pointer is created one in Base and one in Derived.....?
- advha August 16, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Software Analyst C++ - 4of 4 votes
AnswersGiven a set of N points with x,y cords in a 2D plane. Find all possible squares that can be formed with vertices in this set.
- tryingtosolvemystery August 06, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Financial Software Developer - 0of 0 votes
AnswersHow would you weigh an aeroplane
- tryingtosolvemystery August 06, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Financial Software Developer Brain Teasers - -3of 3 votes
Answersclass Test { public void m1(String arg1){ arg1 = "Am I going to disappear?"; } public static void main (String[] args) { Test test = new Test(); String iAmOfAnArgumentativeNature = "I am born new"; m1(iAmOfAnArgumentativeNature); System.out.print(iAmOfAnArgumentativeNature); } }// end class
What is the output?
- SoMiE July 11, 2013 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - 1of 1 vote
AnswersImplement Object Pool for database connections in the following interface
interface Pool{ public Connection get() public void put(Connection c) }
It should have object pool characteristics.
- SoMiE July 11, 2013 in India
Hint - The emphasis is on which data structure you will use to achieve this.| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Data Structures - 0of 0 votes
AnswersIf a java class has methods declared
as followsclass A public synchronized void m1() { //whatever code } public synchronized void m2 { // whatever code } // note that return type is not relevant here.
if a class is created with A a = new A() and
- SoMiE July 11, 2013 in India
if a thread T1 is executing a.m1 and another thread T2 wants to execute a,m2 - what will happen?| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - -3of 3 votes
AnswersA set of milk containers has capacities of 5, 4, 3, 2 , 1 etc . Lets say X containers
- SoMiE July 11, 2013 in India
There is another set of Y containers
If you are going to transfer water from one to the other and each transfer has a fixed cost C, evaluate and state the complexity of the algorithm to achieve a least cost transfer.| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Algorithm - 4of 4 votes
AnswersHow will you calculate the size of the object in java ? I gave answer for the serialized objects. The interviewer then modified the question that an ArrayList contains 10 non-serialized objects. How will you find out which object is the heaviest one ? He again added that the ArrayList is not a generic one, it may contain any kind of object like Organisation, Employee, Salary, PersonalDetails,OfficialDetails etc all object type. Now you have to find out which one is the heavy object through java program. He said there is some way you can measure the size of the object. Please help me.
- Mr D July 09, 2013 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Java Developer Java - 2of 2 votes
AnswersThis question was asked in todays interview's written test. According to me it should go into infinite waiting, but when I run this code on my computer, it safely ends up printing the value. I executed n number of times but still it finishes without without going into infinite waiting.
Can someone explain.
- Anon June 01, 2013 in Indiastatic class Job extends Thread { private int counter; @Override public void run() { synchronized(this) { for(int i = 0; i < 100000; i++) counter++; this.notifyAll(); } } } public static void main(String[] args) throws InterruptedException { Job job = new Job(); job.start(); synchronized(job) { job.wait(); } System.out.println(job.counter); }
| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Java - 1of 1 vote
AnswersA List PARENTLIST which contains primitive type and List L, this List L further can have primitve type and List L and so on. Given a Root node calculate how many List it have
- harsh.k.arora May 04, 2013 in India| Report Duplicate | Flag | PURGE
Goldman Sachs Software Engineer / Developer Algorithm - 0of 0 votes
AnswersGiven a huge file, design a data structure to output all possible anagrams of a particular word.
- xankar April 11, 2013 in United States
For Eg the file contains: "POT, OPT, TOP"
If I query for POT, I should get back all possible anagrams contained in the file.
--| Report Duplicate | Flag | PURGE
Goldman Sachs Senior Software Development Engineer Data Structures - 0of 0 votes
AnswersWrite a program to reverse the sequence of words in a sentence.
- xankar April 11, 2013 in United States
For Eg:
String str = "Today is Wednesday";
Output:
String str2 = "Wednesday is Today"| Report Duplicate | Flag | PURGE
Goldman Sachs Senior Software Development Engineer Algorithm - 0of 0 votes
Answerswhich of the following is true for static member of the class?
- sohit April 09, 2013 in India
a) internal linkage
b) external linkage| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 1of 1 vote
Answers#include<iostream>
- sohit April 09, 2013 in India
#include<exception>
int main()
{
try
{
cout << "sum";
throw 3;
}
catch(...)
{
cout<< "dot";
}
catch(int a)
{
cout << a;
}
catch(exception e)
{
cout << "exception";
}
return 0;
}
what will be the output of the above program?| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 2 votes
AnswerFor the written test please prepare the following topics throughly :
- sohit April 09, 2013 in India
a) virtual function
b) operator overloading
c) namespace
d) template
For interview, please prepare the container throughly with the implementation of list,map etc.| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 2 votes
Answersclass a{
- sohit April 09, 2013 in United States
public:
int var1;
a(int var)
{
var1 = var;
}
};
class b: public a
{
public:
int var2;
b(int d) : var2( d++) , a(var2++)
{
}
};
int main
{
b obj1(5);
}
What will be the value of the variable 'var1' in class A?
a) 6
b)7
c) 5
d) undefined| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 0 votes
Answersclass a{ public: int a; virtual void sum() { printf("sum"); } }; class b : public a { public: int b; virtual void sum() { printf("sum of class b"); } }; void main() { b aptr; a *bptr; bptr = &aptr; bptr->sum(); }
Output of the above program?
- sohit April 09, 2013 in United States| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 0 votes
AnswersWhy the size of the empty class is one?
- sohit April 09, 2013 in India
What are the default functions in an empty class.
does the size of empty class depend upon the compiler or hardware(32 bit or 64 bit)?| Report Duplicate | Flag | PURGE
Goldman Sachs Applications Developer C++ - 0of 0 votes
AnswersAccording to the story, four prisoners are arrested for a crime, but the jail is full and the jailer has nowhere to put them. He eventually comes up with the solution of giving them a puzzle so if they succeed they can go free but if they fail they are executed.
- PCB March 05, 2013 in India
The jailer puts three of the men sitting in a line. The fourth man is put behind a screen (or in a separate room). He gives all four men party hats (as in diagram). The jailer explains that there are two red and two blue hats; that each prisoner is wearing one of the hats; and that each of the prisoners is only to see the hats in front of them but not on themselves or behind. The fourth man behind the screen can't see or be seen by any other prisoner. No communication between the prisoners is allowed.
If any prisoner can figure out and say to the jailer what colour hat he has on his head all four prisoners go free. If any prisoner suggests an incorrect answer, all four prisoners are executed. The puzzle is to find how the prisoners can escape, regardless of how the jailer distributes the hats?| Report Duplicate | Flag | PURGE
Goldman Sachs Developer Program Engineer Algorithm