TCS Codevita

TCS CodeVita Previous Year Questions

TCS CodeVita Previous Year Questions

TCS CodeVita Previous Year 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.

TCS CodeVita 2019 Questions :

Question No. 1 : Salary Paid
Problem 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.

Question No. 2 : Prime Face

Problem Description
Accept a number N up to 5 digits long in the positional numeral system formed by symbols 0, 1, … 9, A, …,Z. Also, accept another symbol S other than zero. Separate N and S with a space. Considering N to be represented in the least base possible between 2 and 36, identify the smallest prime number greater than or equal to N that contains at least one occurrence of S in it in base S + 1. (Refer example section for a better understanding). Prime number should be identified with respect to Base 10 i.e. a regular prime number.
Constraints
1. Length of N <= 5
2. Max Base = 36
3. Face values for symbols:
Symbol => Value in base 10
0 => 0
1 => 1
2 => 2
….
9 => 9
A => 10
B => 11
….
Z => 35
 Input Format
One line containing two integers, N and S separated with space.
Output
Print the smallest prime number greater than or equal to N that contains at least one occurrence of S in it, in
base S + 1.
Test Case
Explanation
Example 1
Input
10 B
Output
B
Explanation
The least possible base for N is 2 and its value in that base is 2. We want the smallest prime number in base 12 (1 more than the face value of B, 11) that contains symbol B and is greater than or equal to 2. The first few numbers in ascending order in base 12 containing face value B are B (value 11), 1B (value 1 * 12 + 11= 23), 2B (value 2 * 12 + 11 = 35): of these the smallest number that is prime is 11, which is greater than N.
Hence, the output is B.
Example 2
Input
ZZ Z
Output
11Z
Explanation
The least possible base for N is 36 and its value in that base is 35 * 36 ^1 + 35 = 1295. The first few numbers in ascending order in base 36 (1 more than the face value of Z, 35) containing face value Z and greater than N are 10Z (1 * 36^2 + 0*36^1 + 35 = 1331, non-prime), 11Z (1 * 36^2 + 1 * 36^1 + 35 = 1367, a prime).
Hence, the output is 11Z.

Leave a Reply

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