Goldman Sachs Interview Question for Software Engineer / Developers






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

class SevenSegmentDisplay{
	public static void main(String args[]){
		int num = Integer.parseInt(args[0]);
		String i = "",j = "",k = "";
		if(num == 1){
			i = "";
			j = "|";
			k = "|";
		}else if(num == 2){
			i = " __";
			j = " __|";
			k = "|__";
		}else if(num == 3){
			i = " __";
			j = " __|";
			k = " __|";
		}else if(num == 4){
			i = "";
			j = "|__|";
			k = "   |";
		}else if(num == 5){
			i = " __";
			j = "|__";
			k = " __|";
		}else if(num == 6){
			i = " __";
			j = "|__";
			k = "|__|";
		}else if(num == 7){
			i = " __";
			j = "   |";
			k = "   |";
		}else if(num == 8){
			i = " __";
			j = "|__|";
			k = "|__|";
		}else if(num == 9){
			i = " __";
			j = "|__|";
			k = " __|";
		}else if(num == 0){
			i = " __";
			j = "|  |";
			k = "|__|";
		}
		System.out.println("\t" + i);
		System.out.println("\t" + j);
		System.out.println("\t" + k);
		System.out.println("\t");
	}
}

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

// LCD segment definitions.
// These will need to be changed depending on the
// wiring of your output port to the segements.
#define a 0x01
#define b 0x10
#define c 0x02
#define d 0x20
#define e 0x04
#define f 0x40
#define g 0x08
#define h 0x80

// LCD Character Generator (stored in Flash).
// Change these defines as needed to make new characters.
const char char_gen[] = {
a+b+c+d+e+f, // Displays "0"
b+c, // Displays "1"
a+b+d+e+g, // Displays "2"
a+b+c+d+g, // Displays "3"
b+c+f+g, // Displays "4"
a+c+d+f+g, // Displays "5"
a+c+d+e+f+g, // Displays "6"
a+b+c, // Displays "7"
a+b+c+d+e+f+g, // Displays "8"
a+b+c+d+f+g, // Displays "9"
a+b+c+e+f+g, // Displays "A"
0x00, // Displays Blank
a+d+e+f, // Displays "C"
a+b+f+g, // Displays "degrees" o
a+d+e+f+g, // Displays "E"
a+e+f+g // Displays "F"
};

#undef a
#undef b
#undef c
#undef d
#undef e
#undef f
#undef g
#undef h

- Ajit May 11, 2012 | Flag Reply
Comment hidden because of low score. Click to expand.
0
of 0 vote

#include<iostream>
using namespace std;


int main(int argc,char *argv[]){
cout<<"Please enter a single digit\n";
char digit = cin.get();
switch(digit){
case '1':
cout<<"|\n|"<<endl;
break;
case '7':
cout<<"_\n |\n |"<<endl;
break;
case '4':
cout<<"|_|\n |"<<endl;
break;
case '0':
cout<<" _\n| |\n|_| "<<endl;
break;
case '6':
cout<<" _\n|_\n|_|"<<endl;
break;
case '3':
cout<<"_\n_|\n_|"<<endl;
break;
case '9':
cout<<" _\n|_|\n _|"<<endl;
break;
case '8':
cout<<" _\n|_|\n|_| "<<endl;
break;
case '5':
cout<<" _\n|_\n _|"<<endl;
break;
case '2':
cout<<" _\n _|\n|_"<<endl;
break;
default:
cout<<"Please enter a valid digit"<<endl;
}
return 0;
}

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

int num = 0;
int arr[7];
arr getSevenSeg(int num)
{
for(int i = 0; i<2; i++)
{
arr[i] = num%2;
}
return arr;
}

for(int i = 1 ; i<=7; i++)
{
syso(arr[i-1]+arr[i]);
}

- Anonymous August 23, 2011 | Flag Reply
Comment hidden because of low score. Click to expand.
Comment hidden because of low score. Click to expand.
1
of 1 vote

Please delete your abusing comment.

- Well wisher June 27, 2012 | Flag
Comment hidden because of low score. Click to expand.
0
of 0 votes

chutiya question

- Anonymous July 13, 2015 | Flag


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