Monday, August 26, 2013

INFOSYS FOUNDATION TRAINING PROGRAM (FTP) SOLUTION FOR LAB-GUIDE ASSIGNMENT PROBLEM SOLVING AND LOGIC BUILDING- part-2

TOPIC 1 : COMPUTATIONAL PROBLEM SOLVING

1.1 COMPUTATIONAL PROBLEM SOLVING AND ALGORITHM

ASSIGNMENT 1.1.1 : PROBLEM SOLVING EXERCISES ( part-b )


1. In an objective type programming contest, following are the rules

a. It will have multiple rounds.

b. In each round, every participant will get a set of 10 question out of which
one question is marked as star question (The toughest one).
c. The participant will get the next set, only if 50% of the questions are
marked correctly in the previous round or he attempted the star question
correctly. Otherwise he will be out of the contest.
It is found that in each round 50% of the participants are not able to attempt 50%
of the questions correctly but one out of those 50% participants, attempts the
star question correctly.
If only 4 participants are left for the 5th round what was the number of
participants in the first round?

SOLUTION :

Let the students appeared for 1st round be = x

Students appearing for the 2nd round :
Since half of them made for the 2nd round, which constitute = x / 2
and 1 candidate who attempted star question
So, total students who made for the 2nd round are = x/ 2 + 1 = (x + 2)/ 2

Students appearing for the 3rd round :
Since half of the previous round students made for the 3rd round, which constitute = ( (x + 2)/ 2 )/2
and 1 candidate who attempted star question
So, total students who made for the 2nd round are =  ( (x + 2)/ 4 ) + 1 = (x + 6)/ 4

Students appearing for 4th round :
Since half of the previous round students made for the 3rd round, which constitute = ( (x + 6)/ 4 )/2
and 1 candidate who attempted star question
So, total students who made for the 2nd round are =  ( (x + 6)/ 8 ) + 1 = (x + 14)/ 8

Students appearing for 5th round :
Since half of the previous round students made for the 3rd round, which constitute = ( (x + 14)/ 8 )/2
and 1 candidate who attempted star question
So, total students who made for the 2nd round are =  ( (x + 14)/ 16 ) + 1 = (x + 30)/ 16


Since it is given that the number of students appeared for the 5th round are =  4

This implies the expression we got for the 5th round i.e. (x + 30)/ 16 becomes = 4
i.e.                                                   (x + 30)/ 16 = 4
                                                         (x + 30 ) = 64
                                                            x = 64 - 30
                                                               x = 34

Since we assumed ' x ' to be the number of students present during the 1st round, which came out to be = 34. It means there were total of 34 students present in the 1st round.


2. A farmer had a lazy son. The farmer wanted his son to work in the farm. So he offered that the son will work for 50 days, for each day the son works, he will get 10 rupees, for each day he will not work, he need to pay back 15 rupees to his father. At the end of 50 days, when the son counted his income, it turned out that he had not got anything. How many days did the son actually worked?

SOLUTION :

Let the son worked for =  x days
money earned for x days = 10x

No. of days on which he didn't work = (50 - x)
Money he lost for days he didn't work = 15 ( 50 - x )

It is given in that the money he earned balances the money he paid back, which means :

                                                      10x = 15 ( 50 - x )
                                                       10x = 750 - 15x
                                                            25x = 750
                                                           x = 750/25
                                                              x = 30
Since we assumed ' x ' to be the number of days for which son worked, which came out to be = 30 days. Therefore, Son worked for 30 days.

No comments:

Post a Comment