TCS CodeVita Previous Year Questions

TCS CodeVita Previous Year Questions

TCS CodeVita 2019 Questions :

We are going to discuss here TCS CodeVita Previous Year Questions. TCS CodeVita is a global coding contest. TCS conducts every year TCS CodeVita to recognize the passionate coders.
By solving these TCS CodeVita Previous Year Questions,it will help you to boost your confidence level as well as your preparation.
It will help you to find your weakness and then you can focus on your weakness.By solving TCS CodeVita Previous Year Questions, will help you to manage the time during exam.

Question No. 1 : Clock Angel :


Proble Description :

There are 360 Longitudes on the Earth, which are equidistant vertical imaginary lines drawn on the Earth, separated by 1 degree each from center of the Earth. Period of the rotation of the Earth on its axis is 24 hours. All countries have their own official times and hence time zones.
UTC is universal time coordinate which passes through 0 (Zero degree) longitude. Time at a particular location on Earth can be calculated using period of the rotation of Earth and longitude of that particular location. For example, Indian time zone IST (Indian standard Time) is located at 82.5° E longitude.
Hence, Indian time can be calculated as below:- IST = UTC + (24/360)*82.5 = UTC + 5:30Hrs
Now suppose we changed period of rotation of the earth using some imaginary power, this will change the time at every longitude on the earth.
Calculate the smallest angle between hour and minute hand of the clock , which shows the difference of time at a particular longitude and the time at UTC i.e. we have to take smaller of the two angle formed between hour and minute hand. AKTU latest syllabus

Constraints :

To show the time difference on clock, 12-hour clock (as shown below) shall be used, irrespective of period of the earth's rotation, for this question only.

Input Format :

  • Period of the earth’s rotation in Hours (Integer only)
  • Value of Longitude up to 2 place of decimal
  • Output :

    Smallest angle between hour and minute hand of the clock, which shows the difference between time at a particular longitude and time at UTC, up to 2 decimal places.

    Test Case :

    Explanation :
    Example 1 : Input..
  • 24
  • 82.50
  • Output : 15.00

    Explanation :

    If period of rotation of earth is 24 hours then time at 82.5 degree longitude will be (24/360)*82.50 = 5:30 and minimum angle at this time between minute and hour hand will be 15 degree.


    Example 2 : Input..
  • 12
  • 360.00
  • Output : 0.00

    Explanation :

    If period of rotation of earth is 12 hours then time at 360 degree longitude will be (12/360)*360 = 12:00 and minimum angle at this time between minute and hour hand will be 0 degree.


    Question No. 2 : Salary Paid :


    Proble Description :

    In a country, there are 'N' slabs for Income tax which are common for all age groups and genders. As an income tax officer, investigating a case, you have the amount of tax paid by each employee of an organization.
    Considering the income tax slabs and rebates offered, you need to find the total amount paid by the organization in salaries to the employees to match it with the amount reported by the organization in its filed Income tax Returns.
    Information regarding the income tax slabs, rebate amount and the income tax paid by each employee of the organization will be provided. Rebate amount is subtracted from the total salary of each employee. Tax is calculated on the remaining amount.

    You need to calculate the sum of total salary paid to the employees in that year.

    Constraints :

    Number of tax slabs = Number of percentage on tax slabs :
    0<= Rebate, tax paid, slab <=1000000

    Input Format :

  • First Line will provide the Amount in each slab, separate by space (' ')
  • Second Line will provide the percentage of tax applied on each slab. Number of values in this line will be same as that in line one, separate by space (' ')
  • Third Line will provide the Rebate considered
  • Fourth line will provide the tax paid by each employee, separate by space (' ')
  • Output :

    Total Salary paid by the organization to its employees

    Test Case :

    Explanation :
    Example 1 : Input..
  • 300000 600000 900000
  • 10 20 30
  • 100000
  • 90000 150000 210000 300000
  • Output : 5300000

    Explanation :

    Slabs and tax percentage indicate that for salary:
    Between 0 - 300000, tax is 0%
    Between 300001 - 600000, tax is 10%
    Between 600001 - 900000, tax is 20%
    Greater than 900001, tax is 30%
    First, we exclude the rebate from the salary of each employee. This will be the taxable component of salary. Upon, taxable salary apply the slab and tax percentage logic.
    Upon computation, one finds that employees are paid amounts 1000000, 1200000, 1400000, 1700000 respectively, as salaries. So, the total salary paid to all employees in that year will be 5300000.

    Hint

    It may be helpful to browse the internet to know general rules regarding income tax calculations.

    Get PDF