Code Practice


  2. Read the Question very carefully in the 1st chance.
  3. Look at the Input and Output Format of the program.
  4. Look at the constraints of the program.
  5. Choose your programming language.
  6. Set the conditions.
  7. Start Coding.
  8. Check Public test cases are passed or not?
  9. Then check Private test cases are passed or not?


Problem 1

Niti and Samy Soft Drink Party

Niti and Samy are the two friends. They are invited in a party. Niti is offered ‘a’ number of soft drinks of X brand and Samy is offered ‘b’ number of soft drinks of Y brand.

But here is a problem that Niti does not prefer X brand and Samy does not prefer Y brand.

Niti prefers Y brand and Sami Prefers X brand. They decide to switch their drinks to each other and Niti will take one more of her preferred brand and Samy will also take two more of her preferred brand. So at the end of the party how many number of drinks will be to Niti and Samy?


5 8


9 7

Input restriction



Problem 2

Washing Machine


A Washing Machine works on the principle of a Fuzzy system, the weight of clothes put inside it for wash is uncertain. But based on weight measured by sensors, it decides time and water levels which can be changed by menus given on the machine control area. For low Water level, time estimate is 25 minutes, where approximate weight is 2000 grams or any non-zero positive number below that.

For Medium Water level, time estimated is 35minutes, where approximate weight is between 2001 grams and 4000 grams. For High Water level, time estimated is 45 Minutes, where approximate weight is above 4000 grams. Assume the Capacity of the Machine is maximum 7000 grams. Where the approximate weight is zero, the time estimate is 0 minutes.

Write a function which takes numeric weight in the range [0,7000] as input and produces estimated time as output; if input is more than 7000, then output is: “OVERLOADED!”, and for all other inputs, the output statement is “INVALID INPUT”. Input should be in the form of integer value – Output must have the following format – Time Estimated: Minutes

Example 1
Input Value
Output Value
Time Estimated: 25 Minutes

Problem 3

Hens and The Owner

In a poultry, there are n number of hens. Each hen lays 5 eggs per day and each day 13 eggs are damaged. When the total number of eggs are greater than 850, the owner sells per egg at Rs 5. When the total number of eggs are greater than 200, the owner sells per egg at Rs 5.50.When the total number of eggs are lesser than 200, the owner sells per egg at Rs 6. What will be total earning of the owner if he sells all the eggs in the dth day?

Input Constraint

n>=5 and n<=20

d>=0 and d<=10






Problem 4

NQT Preparation

Arnita is preparing for TCS NQT and solving puzzles everyday from R S Agarwal. She starts at HH1:MM1:SS1 time and ends at HH2:MM2:SS2 time. How many seconds she takes time for preparation?

Input Constraints




It may be possible HH1>=HH2

then consider HH2 is the hour after midnight


22 40 50

23 50 58




22 40 50

2   5 40



Problem 5

Success Party

Arpan is now a software engineer of Cognizant. Company CEO had invited many renowned

people of many companies in their Grand Party to celebrate the success altogether. But to make this event private and secured, CEO decided to make a system checker that will check the originality of the entry pass. He asked to Arpan and then Arpan made a plan. Arpan decided that a unique number will be on the card by which we can identify the real pass.

The number should be of 6 digits and should have at most 2 factors. So, the system will check the number and decide “Real” or “Fake”.

Sample 1





Sample 2





Sample 3





Problem 6

Movie Ticket

Bapan, a handsome guy decides to go for a movie with his partner. But recently a problem occurs. Bapan can not remind the numbers. When someone asks him the number, he always tells just the reverse of it. But his partner is too intelligent and makes a plan. She has decided she will pick up those ticket that will have also the same meaning to Bapan. She went to the ticket counter and asked the boy for the ticket. Now, write a program that will ensure Bapan’s partner will accept the ticket or not?









Things To Remind

Leave a Reply

Your email address will not be published. Required fields are marked *