GE Code Writing Test Questions
I had shared my GE experience in my last post i.e. GE Placement Pattern - MY Review.
I have received good feedback.
Please do comment and ask any queries you have.
Today, i am gonna write about the GE Round 2: i.e. Code writing problem.
If u have cleared the GE aptitude test,you will receive an Email from GE (within 10-15 days).
Email will be containing 3 attachments having one problem in each attachment.
Source: Real Email shared by Mr. Harshad Kambale (RAIT BE Comps 2010)
________________________________________________________________________
Congratulations,
You have been shortlisted from the Aptitude/Technical Test, which was held last Saturday, 17th April, 2010. You need to solve code writing problem given below, as per the responses received we will call you in our GE office next week from 28th onwards for recruitment process.
Rules:
- Please solve it on your own/submit your own solution. You may be asked to build an extension to this program or an advanced variant of this type of problem in person in the future.
- You may implement the program in either C/C++/C#/VB.Net/Java. If you choose to use C or C++ please mention the compiler version that you’re using in an email.
- Submit your source code as a single file as an email attachment (Do not compress it to zip/archive format). We would compile your program into an executable and run it (e.g. c:\>SomeName.exe TestCases.txt)
- The program will not expect any user input. Please test your program for compile / run time errors before submitting.
Openings exist at Lead Software Engineer , Software Engineer , and QA / Test Engineer levels with the Software Solutions Group of GE Energy in Mumbai and Hyderabad . The Software Solutions Group (SSG) , has been set up to provide advanced software solutions, based on SOA, C++/DCOM,.NET, Test Automation, Decision Support and Optimization technologies to monitor, protect, control, and validate the safety of critical industrial assets, processes and applications. SSG has development centers in Mumbai, Hyderabad in India, Minden , Norfolk, Atlanta, Melbourne in the US and Cambridge in UK and follow a global, unified set of processes, standards, methodologies and software lifecycle tools.
Reply to <geii.careers.mumbai@ge.com>
Sincerely,
GE India Industrial Pvt. Ltd.
Human Resourceswww.ge.com
geii.careers.mumbai@ge.com
________________________________________________________________________
Problem No. 1
Time limit of execution is 3.00 seconds.
Implement method/function which follows given signatures :
For Cpp:
void prime_sum(int n,int sol[ ]);
The input contains one integer number N (N<=100000). This number you will have to express as a summation of 4 primes and an array of interger where you have to store all 4 numbers.
If summation is not possible then just fill first 4 entries of array as -1.
For C Sharp :
public int[ ] prime_sum(int n);
The input contains one integer number N (N<=100000). This number you will have to express as a summation of 4 primes.
Your method should return an array containing 4 prime no.
If given no can not be expressed in expected form then it should return null value.
Sample Input :
28
42
Sample Output:
7 11 3 7
7 11 17 7
Problem No. 2
Adding two numbers:
"Write a function/class to add two integers."
You have to design only function/method to accept two integers and return back their sum. Your function must follow following
Prototype.
For C ++ :
int addno(int ,int);
For C Sharp :
public int addno(int,int);
2. Solving The problem :
For above example :
For C++ :
just enter ,
int addno(int a,int b)
{
return (a+b);
}
For C Sharp :
just enter :
public int addno(int a,int b)
{
return (a+b);
}
What NOT to enter :
* Header files
* Include statement
* Printing statement
* Anything that will generate Exceptions .
Basically anything But the above structure should not be entered in that area.
Problem No. 3
Input Output
[ 0 ]
[ 1 ]
[ 0, 1 ] 1
[ 1, 1 ] 2
[ 1, [ 1, 2 ] ] -2
[ 1, 2, [ 8 ] ] -5
[ 1, [ 2 ], [ 3 ] ] -4
[ 9, [ 3, 4, [ [ 2 ] ] ] ] 0
Design a function/methos to implement above pseudo code by following prototype as
For CPP :
int ExpressEval(char * expression);
For C Sharp :
public int ExpressEval(string expression);
Input:
Accept expression to be evaluated as a string.
Output :
Return result of evaluation as an integer.
For e.g
consider input string to be "[1, 2 , [5 , 3 ] ]"
then your function must return -5.
Just design above method do not implement entire program/class.