Goldman Sachs Interview Question for Analysts






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

How about using state pattern

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

// code showing basic software design

class ATM; class ReceiptInfo;
class ATMImpl{
	friend class ATM;
	private:
		ATMImpl(){/*implementation*/}
	public:
		float getBalanceInfo(){/*implementation*/}
		ReceiptInfo getReceiptInfo(){/*implementation*/}
		bool deposit(float val){/*implementation*/}
		bool withdraw(float val){/*implementation*/}
		bool verifyPIN(int pinVal){/*implementation*/}
		~ATMImpl(){/*implementation*/}
};
class ATM{
	private:
		ATMImpl *d;	//pointer to ATM implementation
	public:
		inline float getBalance(){return d->getBalance();}
		inline ReceiptInfo getReceiptInfo(){return d->getReceiptInfo();}
		inline bool deposit(float val){return d->deposit(val);}
		inline bool withdraw(float val){return d->withdraw(val);}
		inline bool verifyPIN(int pinVal){return d->verifyPIN(pinVal);}
};

class ATM_GUI{
	private:
		ATM atmObj;
	public:
		ATM_GUI(){/*initialize GUI*/}
		void printReceipt(){atmObj.getReceiptInfo();/*more implementation*/}
		void printBalance(){atmObj.getBalance();/*more implementation*/}
		inline bool verifyPIN(int pinVal){atmObj.verifyPIN(pinVal);}
		inline bool withdraw(float amount){atmObj.withdraw(amount);}//Atomic operation
		inline bool deposit(float amount){atmObj.deposit(amount);}//Atomic operation
		//more methods (operations)
};

- GekkoGordan January 26, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Great Logic

- Chandan Punjabi April 25, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

zjchjhclzc

- yogesh January 01, 2015 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream.h>
#include<conio.h>
class BANK
{ private:
int acno;
char name[30];
long balance;
public:
void open_account()
{
cout<<"enter the account nomber";
cin>> acno;
cout<<"enter the name";
cin>>name;
cout<<"enter the balane";
cin>>balance;
}
void show_account()
{
cout<<acno<<","<<name<<","<<balance<<","<<endl;
}
void deposite()
{
long ammount;
cout<<"enter the ammount";
cin>>ammount;
balance=balance+ammount;
cout<<balance;
}
void withdrawal()
{
long ammount;
cout<<"enter the ammount";
cin>>ammount;
if(balance-ammount>=0)
{
balance=balance-ammount;
cout<<balance<<endl;
}
else
{
cout<<"less amount........."<<endl;
}
}
int search(int);
};
int BANK::search(int an)
{
if(acno==an)
{
show_account();
return(1);
}
return(0);
}
void main()
{
int a,found,an,i;
clrscr();
BANK c[5];
for(i=0;i<=4;i++)
{
c[i].open_account();
}
do
{
clrscr();
cout<<" display all account no."<<endl;
cout<<"1.desplay by account no."<<endl;
cout<<"2.desplay deposite ammount"<<endl;
cout<<"3.desplay withdrawal ammount"<<endl;
cout<<"4.exit "<<endl;
cout<<" enter or choice";
cin>>a;
switch(a)
{
case 1:
for(i=0;i<=4;i++)
{
c[i].show_account();
}
break;
case 2:
cout<<"enter the account no.";
cin>>an;
for(i=0;i<=4;i++)
{
found=c[i].search(an);
if(found)
{break;}
}
if(!found)
{
cout<<"invalid account .........."<<endl;
}
break;
case 3:
cout<<"enter account no.";
cin>>an;
for(i=0;i<=4;i++)
{
found=c[i].search(an);
if(found)
{
c[i].deposite();
break;
}
}
if(!found)
{
cout<<"invalid account no."<<endl;
}
break;
case 4:
cout<<"enter the account no.";
cin>>an;
for(i=0;i<=4;i++)
{
found=c[i].search(an);
if(found)
{
c[i].withdrawal();
break;
}
}
if(!found)
{
cout<<"invalid account no."<<endl;
}
break;
case 5:
break;
default:
cout<<"enter option..........."<<endl;
}
cout<<" press any to countinue........."<<endl;
cin>>a;
getch();
}
while(!a);
}

- shivam singh January 06, 2016 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

Grateful Wizards, My regard to you all

- Ahmad maidugu October 29, 2016 | 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