Sapient Whole Testpaper |   9519

Sapient Whole Testpaper

SAPIENT PAPER ON 9TH APRIL,2008

Today I am a proud member of Sapient after getting rejected from 4 companies like TCS, INFOSYS, ACCENTURE and IFLEX.
Whole drive was divided in two steps. In first round we had to code two questions within an hour. Problem was about abusive words and train reservation. Results were announced after a week and second round was conducted after 11 days of results which was again divided in two parts. I have written the questions of both rounds below. In second round again we were required to code two problems within an hour. Problems were regarding compression and post-mails. In second round written examination was not an elimination round. They took interview of all the students who cleared the first round.   After that interviews were held which lasted from half an hour to an hour generally.

Interview
You should be strong with C/C++ concepts, OOP’s concepts, Data Structures, DBMS, Software Engineering, Operating Systems. They can ask any question from these subjects as a CSE/IT student should be aware with these topics always. They also ask about summer training and other projects which you have done. Also you should be completely thorough with each and every word of your Resume. He asked me about quick-sort, introduce my project, normalization, data structures. He also asked about pointers to my friends and in much detail. Say each and every word with confidence and show him your determination. He will ask you what do you understand from the problem given in the written examination and how you proceeded. Mind that those guys are too technically strong and they scan your paper within 1 min. and are aware about your codes shortcomings and mistakes where you have done. So don’t lie with them and be honest.

Written
Watch out all the previous problems of sapient and try to solve them implementing your own logic. Don't copy answers from net and other sources as they are fed up with those answers and want new logic or if same logic is used, then a new way of implementing that problem. Prepare at least two solutions of all problems and read carefully question paper as they always use to make some changes in problems. Now days they have started giving new problems. You should be completely clear with your logic and concept as during interview you will be grilled over it mainly. Write comments properly and show some cuttings in your sheet too as it was asked during interview why there is very little cutting in your paper.

Questions:
Round1:
1)  Abusive Words
A message was given in which we have to replace abusive words like (stupid, fool) with # or with other letter. No. of # depends on conditions like it can be equal to the length of the word like stupid is to be replaced with ###### but in my question an abusive word has to be replaced by ### (3 #) only. The word is listed in some look up table in Max_list_word.
Logic will remain same but there will be slight variations, so read the questions carefully.

2)Train Reservation
There are 67 seats in a train in which there are rows of five seats and last row contain only two seats. A person can allocate maximum 5 seats on his name. Also last 2 seats are to be allocated first if reservation for 2 seats is demanded. Also customer should be allocated seats in a row or nearby seats if not possible.  
The following class is given
 public class seat
 {
 char name;
 int seat;
 boolean isSeatempty
 }
 
 Write function seatallot(int noofperson) to allocate seat with seat nuber printed for the each name.


Round2:
1)  Compression of a string
Take any string and we have to compress it so it can be passed over a congested network           easily. If string is AASSGGTHMMEG then compressed string will be A2S2G2THM2EG. But in   my question compressed string should be 2A2S2GTH2MEG. So again read the problem carefully. If compressed string contains letters other than alphabets or digits i.e. if compressed string is like 2A3DY(3!%#^*2@)A2S then all these non alphanumeric characters should be cleaned off.
We have to make functions:
Compress()
Clean()
) Post mail Question

Conditions are given like if you cover some distance you have to pay this amount, if postal weight is this then u have to pay this amount.
Thus five to six conditions are given, you have to write the program to get the cost of post-mail per company depending upon its destination and weight.
Very simple program just use if and else loop.
Given: getdistance() is function which gives you the distance between two cities.

Conditions are:
Weight<15 gm and Distance<100 km then cost=Rs. 5
Additional cost of mail should be calculated according to the following slab
Weight 15-50 gm = Rs. 2/gm

           >50 gm = Rs. 3.5/gm
Distance 100-500 km = Rs. 1/km

             >500 km = Rs. 2/km

(Here charges are factious to just give you an idea of the question)
If the cost of the mails exceed Rs. 1000 then 20% discount is offered to the company. 

Report has to be generated per company displaying there mail details for a single day.
Mails with weight less than 15 gm and distance less than 100 km are :
Mails with weight 15-50 gm are:
Mails with distance 100-500 km are:
Mails with weight greater than 50 gm are:
Mails with distance greater than 500 km are:
Total cost due to mails to company:

Also mail reports should be printed in sorted order for each company.

feedback