Sei sulla pagina 1di 12

Paper Type : Technical - Other

Test Date : 11 April 2008

SAPIENT PAPER ON 11TH APRIL,2008

Hi friends, Here I m making for u available all the technical questions that are asked in the
written of Sapient . The problems that are given below were asked in either of the two
technical written of sapient. Thoroughly go through all these programs ….. make them by
your own that will be much better because the technical interview is maximum based on the
2nd written paper i.e. u must be clear with the concepts and especially the logic behind the
solution for the program made by u.

Instructions:
Write appropriate comments for your code wherever required.
Focus on the approach & demonstrate problem comprehension & logic.
Assume anything required & clearly indicate your assumptions. Note: Don‟t write any input
functions such as main().

Program1. Reservation
there are 67 seats in train . there are only 5 seats in a row and in last row there are only 2
seats. One person can reseve only 5 seat at a time. If person reserving seat , the care is taken
that he may get all in row. If seats are not available in row then the arrangement is so that
person group get nearby seats.
The following class is given
public class seat
{
char name; int seat; boolean is Seatempty
}

1.Draw require class diagram and object diagram.


2. Write function seatallot (int noofperson)
to allocate seat with seat number printed for the each name.

Program 2. Stringreplace
The forum is going on and administrator find that some people use abusing or bad language
in discussion.so he decided that when he uses such language it was replaced with beap.
question:
1. draw class diagram,and use appropriate data structure.
2. write function replacestring()

1) Write a program for the problem: the array of integers indicating the marks of the students
is given, U have to calculate the percentile of the students according to this rule: the
percentile of a student is the %of no of student having marks less then him. For eg:
suppose Student Marks
A 12
B 60
C 80
D 71
E 30
F 45
percentile of C = 5/5 *100 = 100 (out of 5 students 5 are having marks less then him)
percentile of B = 3/5*100 = 60% (out of 5, 3 have marks less then him)
percentile of A = 0/5*100 = 0%.

2) The code was given for a problem and u has to identify the logical error in it. That was
simple. The code was to merge the Danagrams of 2 words. The denagram of a word is the
letters of word arranged in sequential order. eg danagram of abhinav is aabhinv. merging of
Danamagram is to merge the danagrams of 2 or more words such that the highest no of
occurance are coming for each alphabet.
eg merging of aabhinv and abbhhixz is aabbhhinvxz.

3)you have to write a program to calculate the sales price of the product for a given
conditions. it is very simple. (20 minutes)

4) You need to create a class diagram or data model for the given requirements. The
requirement is as follows:-
In a village there are only few families and there were only one newspaper/magazine agent.
there are lot of news paper and magazine available and every month a new magazine or
newspaper it introduced. Every family is getting at least one newspaper or magazine.
Every month at the end the cost is calculated and collected. Suppose if a family wants to
cancel the subscription, they should be able to do it at any day of the month. The family
should be billed only for the days which they got the newspaper or Magazine. The agent
plans to buy a computer and proceed. Please create a class diagram or data model which
helps him in developing a new software for it. Do not write the code or Flowchart.(25
minutes)

5) . Design a class diagram or data model for this problem:-


A company has some clients and some officers. Also it has some rooms to be used for
meetings between client and officers. One officer is responsible for each room. And room has
unique room id. A meeting will be arranged only when the officer and client are free
and room is also free. The officer and clients must be registered to the system which will give
them unique email ids. Arrange the meetings. Don‟t write code.

6) Write a program to find the occurrence of characters '!', '$' '?' '.' ',' etc. Also write a function
to replace all odd occurrence of '?' to ' . ' .

7) There was a given program to insert a value at the proper position in a doubly linked list.
There was some logical error in that due to which it was not working properly. Find out that
error. It was easy.

Java Program to convert the numeric to Words, and there was a bug in it. we have to solve it
and give the comments. There is no Syntax error but only the logical error. The program
compiles without errors and runs, but the desired output is not got. for example
Input: 456
Output : four hundred and fifty six (correct)
Input :14000
Output : hundred and fourteen thousand. (wrong)
Desired output : fourteen hundred thousand.
Input :235126
output : hundred and two hundred and thirty five thousand hundred and one hundred and
twenty six (wrong)
I am not much clear about the question but frame it out.(15 minutes)

Additional 2 programs to search an element immediately gr8r then all present in an array
without sorting and a modified version of it to handle all error conditions

Instructions:
1. Write appropriate comments for your code wherever required.
2. Focus on the approach & demonstrate problem comprehension & logic.
3. Assume anything required & clearly indicate your assumptions.

Qs.1: A company has many employees & each employee is led by only 1 person except for
the CEO (who has no boss). The cost to the company of an employee is the sum of his salary
plus the cost to the company of all the people led by him. Given is the following structure :
Employee
Data members:
Name
Salary
isBoss
nameOfBoss

Methods:
getSalary
getName

a) Define the class/structure


b) Write a function get Cost To Company() to calculate the cost to the company of an
employee whose name is passed as a parameter to the function get Cost To Company()
public float get Cost To Company (String name)

Note: Don’t write any input functions such as main() & assume that the data structures
have already been defined.

Qs. 2: Generate an ordered sequence of 4 unique alphabets, where an ordered sequence is one
which is arranged in ascending alphabetic order.
Eg. Ordered : ABCD, BCHU, KRXZ
Unordered : DCBA, BNMA

Technical interview: 50 minutes technical interview .


10 min: Debugging
q1 .They had given me one program for debugging. The program is in java .and don‟t have
any syntax error. Just logical error.
10 min : Then told me to correct the mistake I had done in 2nd round answer paper.
10 min :About My project
10 min :curriculum /academic subjects .
10 min :Extra activity – like IEEE membership / achievements / seminars / paper presentation
/ competitions etc.
Paper Type : Whole Testpaper
Test Date : 9 April 2008

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:

Paper Type : Whole Testpaper


Test Date : 11 August 2007

SAPIENT PAPER ON 11th AUGUST AT MYSORE

The test was on 11th Aug 2007, in Vidya Vardhaka College of Engineering, Mysore
There was two rounds.
1) Code a problem
2) Tech Interview - this was after a week in Bangalore JSS college

I hope you will find help from this info. sharing…!!

Problem(1 hour duration)


There are three ICFAI exam centers, candidate can choose online these exam centers with
preference. Ex like:
1st preferernce EC-B
2nd preference EC-A
3rd preference EC-C

There are two classes


Class candidate
{
1st preference
2nd preference
3rd preference
Exam_date
}

Class Avail_seat
{
Seat_avail_in_A
Seat_avail_in_B
Seat_avail_in_C
}

Allocate the seat as per 1st preference, if not available, then allocate 2nd preference.
WAP to implement the concept. (You can avoid the main and not important codes).
I coded like this

Class candidate
{
1st preference
2nd preference
3rd preference
Exam_date

Public :
Int Get_first_preference()
{
(char) Return 1st preference;
}
\
Int Get_second_preference()
Int Get_THIRD_preference()

Date GET_DATE()
{ }
}
Class Avail_seat
{
Seat_avail_in_A
Seat_avail_in_B
Seat_avail_in_C

Public :
void set_seat_A()
{
Seat_avail_in_A = Seat_avail_in_A – 1 ;
/* so one seat will reduce from the total seat available in the ecam center A */
}
void set_seat_B()
void set_seat_C()

int get_seat_A()
{
Will return the seat available in the EC- A
}
Int get_seat_B();
Int get_seat_C()

Other than the above classes, I took one more class, which is
Class alloc_seat : inheritence candidate /* I used inheritance in my program also, so a syntax
error…!!
{
char seat_allocated;

public :
void seat_allocated(candidate_list[]) /* This is the main function they are explicitly asked
*/

}
void alloc_seat :: seat_allocated(candidate_list[])
{
/* program flow
if date is the required date
{
If(Get_first_preference() = „A‟)
{
If(get_seat > 0)
Set_preference(); /* So the EC-A seat will will be deducted by one;
Seat_allocated = A ;
}

elseIf(Get_first_preference() = „B‟)

else If(Get_first_preference() = „C‟)

If(seat_allocated == NULL) /* If seat is not selected */


If(Get_second_preference() = „A‟)
If(Get_second_preference() = „B‟)
If(Get_second_preference() = „C‟)

If(seat_allocated == null)
If(Get_third_preference() = „A‟)
If(Get_third_preference() = „B‟)
If(Get_third_preference() = „C‟)

Else
Cout<< “Seat is not available on this date.”
}
}
Above code is only for a particular day. To do it for all dates which is in
calendar…?? Check it out
Tech Interview (Pure technical, around 1 hour duration)

This was on another day in Bangalore JSS college.


They will check your confidence, understanding capacity of a problem and also analyzing
and solving capacity. They least bother about HR questions.
These are the questions..
1) How you feel to study again(I was worked for one year)
2) Tell me about your self
3) Define the first round problem briefly
4) Did you implement fully?
5) I was asked to explain the program, which I did in first round
6) Asked to complete what I missed in first round(Date).
7) Explain static global structure
8) Implement virtual function
9) Do you want to ask any thing?
a) Requirement of fresher‟s in Sapient
b) About the internship
10) Will you work up to 12 night?
11) Will you work in testing?
12) Feedback was given on the spot interview panel

Be very confident, and be good in C/C++, OOPs concepts. Then Sapient will be yours..!
Finally I got selected in Sapient with 3.6 L pa for first 6 month and then after 4.2+ L p.a. This
will be increment depends on your performance.

Paper Type : Candidate Experiences


Test Date : 19 October 2006

SAPIENT PAPER ON 19th OCTOBER

hi frenz,

it's abt sapient paper.

it consist of two programs which sud be devloped using c++ \ java only

1) thr is a train which have 67 chairs in forms of rows, each row contains 5 chairs.
if a person wants more than 1 seat those sud be reserved cosicutively.& if seats r not available
then a msg sud b print"required no. of seats r not available"
at last print the passengers name with thr chair nos.

2) if a input string contain some restricted words(list was given) then instead of those words
"***" sud b printed.or a beep sound sud b produced.
Paper Type : Whole Testpaper
Test Date : 21 April 2006

SAPIENT PAPER ON 21st APRIL 2006

I went thru the interview on 21 Apr 2006 and got selected.


There were two rounds.
1. Written test which contain two questions -1 Hour
2. HR & Tech Interview combined- 1 Hour

There was two questions in written test.

Round 1. Written
Q1. A Postal department receives postal letters from different companies. A postal mail has
some weight and distance. Rates for each slab according to weight and distance was
mentioned.
0-15 gm
15-50gm
50+ gm
0-50 KM
50-500 KM
500+ KM
Create a PostalMail class. which shud have CalculateCost method. Also Postal Department
has to generate Report for each company which contains count of letter for each slab and total
cost of all mails which were sent by that company. If total amount exceeds Rs. 1000 then
give 20% discount.
This generateReport method whould take parameter as array/List of PostalMail class.

Q2. There was some string given AAAZBBBDDDDFF which is compressed as


3AZ3B4D2F. write a method compress which takes uncompressed string and returns the
compressed string. Also during the n/w transmission of compressed string some invalid chars
get embedded such as 3A$B^5#F Write a method to remove these invalid chars.

Both the questions were easy but do them with great care and read the questions carefully
because only these question will decide wether u r thru or not. If u make any mistake during
in written then they will ask u to correct in interview.

Round 2: Interview
The interviewer was a cool guy. He started with asking about myself. Then he asked me to
explain scenario of the questions given in written exam and to correct the mistakes i did in
paper. He asked me is your program capable of handling null and newline characters. He
gave me some sample strings to compress, which i did easily. Asked me lot of questions
about my project. Asked some basic HR questions. Such as Team Leading, Team Member
skills. I already have an offer for other giant Indian IT comapany. He asked me why u want to
leave such a big company. Then he asked me if u have any questions. I asked him about what
type of projects do they take, what is team size here, how do they capture client requirements
and how much time it takes. Why their written exam is different form other giant IT comapny
exams. What skills they look out for in a candidate. Hope this will help u.
Paper Type : Whole Testpaper
Test Location : MUMBAI

SAPIENT PAPER AT MUMBAI

Sapient test 2nd round :Oberoi - Mumbai.

This is also technical round .Duration 1hr .


You have to write two programs .in any language .preferably c++ and java.

Program 1.
Name : Post - mails
Some 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 distance of
post - mail / sort / print / the result .
Very simple program just use if and else loop .
Given : getdistance() is function which gives you the distance between two cities.

Program 2
Name : compress and decompress the string .

One string is given like : aaabbbbbcddddeeee


You hav to compress the string like a3b5c1d4e4

And it may happen while transferring the compress string some non alphanumeric characters
can add in compressed string so compressed string can become a@3b%5c*1d$4e4 like this
you have to remove this extra characters.

Those who cleared this test hav technical interview round

Technical interview :
50 minutes technical interview .
10 min:Debugging
q1 .They had given me one program for debugging. The program is in java .and don‟t hav
any syntax error. Just logical error.

10 min :
Then told me to correct the mistake I had done in 2nd round answer paper.

10 min :
About My project

10 min :
curriculum /academic subjects .
10 min :
Extra activity - like IEEE membership / achievements / seminars / paper presentation /
competitions etc.
5 min:
Feedback .

Those who cleared this round set for business interview.

Potrebbero piacerti anche