TCS IMPORTANT QUESTIONS
TCS Pattern:
Section Total Time Total Questions
Part A: Foundation Section
Numerical Ability 25 mins 20 Q
Verbal Ability 25 mins 25 Q
Reasoning Ability 25 mins 20 Q
Part B: Advanced Section
Advanced Quantitative + Reasoning Ability 25 mins 15 Q
Advanced Coding 90 mins 2Q
Total Duration 190 mins
APTITUDE QUESTIONS
1. Find the greatest numbers, when 556 and 2028 is divided and leaves
remainder as 4 on each case.
A. 92 B. 138 C. 184 D. 276
Solution:
Adjust the numbers by subtracting the
remainder 556 – 4 = 552
2028 – 4 = 2024
552 = 2^3 * 3*23
2024 = 2^3 *11*23
HCF = 8*23 = 184
Answer: 184
2. The product of two numbers is 845, if the first number is 5 times of the
second number. Then the sum of two number is?
A. 78 B. 80 C. 82 D. 84
Solution:
Two numbers a,b = ab = 845,
a = 5b 5b*b = 845
b^2 = 169
b = 13, a = 65 (Sum of two numbers = a+b =
65+13 = 78) Answer: 78
3. Two men can complete a job in 15 days, then how many man can
complete a job in 3 days?
A. 8 B. 10 C. 12 D. 15
Solution:
M1 * D1 = M2 *
D2 2 * 15 = M
*3
M = 10 days
Answer: 10 days
4. The average of 10 numbers was found to be 40 later on. It was
detected that a number 40 was misread as 44. Find the correct average of
the given numbers?
A. 49.6 B. 39.6 C. 29.6 D. 59.6
Solution:
Sum of numbers = 10*40 = 400
It is stated that the number 40 was misread as 44, correct sum = 400 –
44 + 40 = 396 Average = 396/10 = 39.6
Answer: 39.6
5. A car travel a distance from A to B with a speed of 30km/h and return
from B to A with the speed of 60 km/h. what is the average speed of car?
A. 40kmph B. 20kmph C. 30kmph D.
28kmph Solution:
Average speed = 2xy/(x+y) [Same distance] =
(2*60*30)/90 = 40kmph Answer: 40kmph
6. The average score of 12 students in an examination was 52.5 Later on
checking the marks of two students were changed from 45. and 51 to 40 and
62 Respectively. Find the corrected average marks of the students
A. 53 B. 48 C. 32 D. 28
Solution:
Sum of all the student in an examination.
= 52.5×12 =630, New total = (630-45-51+40-62), Average = 636/12=53
Answer: 53
7. An article X Sold to M at a loss of 5%. and Same article sold to s at a
profit of 40% with package of 18 and S bought for Rs.1841. Find the x value?
A. 1260 B. 1300 C. 1370 D. 1400
Solution:
SCP = Rs.1841
M Selling 40% of profit to
S 140% of C.P = S.P
[S.P=1841]
C.P = (1841×100)/140 =1315
M buying a product
(1315-118=1197) X sold 5%
loss to M
95% of C.P=1197, C.P=1260
Answer: 1260
8. The person salary per month is Rs.7450 and his saving per month is 32%.
Find the expenditure?
A. 5066 B. 5100 C. 5200 D. 5300
Solution:
Total-100
% Saving
32%.
Expenditure 68%.
E= 68% of Salary = (68/100) x7450 = 5066
Answer: 5066
9. {(19/18 * 9/19) ÷ (2/7 * 14/6 + 2/6)} +9/5 ÷ 8/14 of 14/5 = ?
A. 13/8 B. 2/9 C. 13/9 D. 11/4
Solution:
= ½ ÷ (4/6 + 2/6) + 9/5 ÷ 8/14 * 14/5 = ½ ÷ (1) + 9/5 ÷ 8/5
= ½ + 9/8 = 13/8
Answer: 13/8
10.Find the minimum value of f(x) = 2+|2x + 12|
A. 4 B. 2 C. 6 D. 5
Solution:
To minimize f(x), we minimize∣2x+12∣. The minimum value of∣2x+12∣ is
0, achieved when: 2x + 12=0
Solve for x: 2x = −122x = −6
Substitute x = −6 into f(x): f(−6) = 2 + ∣2(−6) + 12|, f(-6) = 2+ 0,
f(−6) = 2 + 0 = 2 Answer: 2
11. when the radius of sphere is 56cm what is the total surface area of
sphere?
A. 39424 cm² B. 40000 cm² C. 38000 cm² D. 39000 cm²
Solution:
T.S.A of Sphere = 4πr^2 = 4 x 22/7 x 56 x 56 =
39424 cm² Answer: 39424 cm²
12. Three number are in the ratio of [Link] if the sum of the largest and the
smallest number is 9800, then what is the difference of the largest and the
smallest number?
A. 4200 B. 1200 C. 4600 D. 1800
Solution:
abc
2x : 3x : 5x Sum of the largest and
smallest number 2x+5x⇒7x = 9800
x = 1400 Difference of the Largest and
smallest number 5x-2x = 3x = 3x1400 =
4200
Answer: 4200
1. Find the greatest number when divided 309 and 235 leaves remainder as
5 and 7?
A. 16 B. 18 C. 22 D. 20
Solution:
309-5=304, 235-7=228
HCF (304, 228)=76
Answer: 16
2. The product of two number is 5120, and first number is 5 times of the
Seond number. Find the sum of two number?
A. 192 B. 188 C. 200 D. 220
Solution:
Two Number x
& y xy = 5120,
x = 5y 5y
xy=5120
y^2 =1024
y = 32 , x = 160
Sum of the numbers =
32+160=192 Answer: 192
3. 9^2+ √5^2 - 10√9 – 1 simplify
A. 38 B. 55 C. 42 D. 50
Solution:
The given expression, 9^2 + + √5^2 -
10√9 – 1 Simplify each term:
9^2 = 81, √5^2 = 5, 10√9 = 10 * 3 = 30
Substitute into the expression, 81 + 5 – 30 – 1 = 55
Answer: 55
4. If 480 divided into [Link] find the difference between Largest and
Smallest number?
A. 36 B. 40 C. 45 D. 50
Solution:
ABC
15x: Bx: 12x 4
40x = 480
x=12
Difference Between Largest & Smallest number = 15x - 12x = 3x =
3x * 12 = 36 Answer: 36
5. A & B started a business with investments of ₹10000 and ₹20000
respectively. After one year they earned a total profit of ₹3160. 10% of the
profit is given to A for handling the organizations structure Find B’s share of the
profit?
A. 1896 B. 2000 C. 2100 D. 2200
Solution:
A & B investment ratio 10000 :
20000 = 1 : 2 Total profit = Rs.3160
Handling charge = 10% of
3160 = 316 Remaining profit
= 2844
1x + 2x = 2844
3x = 2844
X = 948
B’s profit 2x = 2*948 =
1896 Answer: 1896
6. Riva and Nisha Salary -are in the ratio 5:8 and expenditure is in 1:4. The
Saved 4800 each. Find the Riva salary?
A. 6000 B. 8000 C. 10000 D. 12000
Solution:
R : V income ratio=5x:8x, Saving each 4800,
Expenditure is in 1 : 4 5x - 48008 : 8x - 4800 = 1:4
20x - 19200 = 8x-4800
12x = 14400
x = 1200, Riva Salary 5 * 1200 = 6000
Answer: 6000
7. A person salary per month is Rs.7590 of saved with 60% what is
expenditure
A. 3036 B. 3100 C. 3200 D. 3300
Solution:
Saved – 60% Expenditure – 40%
40% of 7590 = 2/5 * 7590 = 3036
Answer: 3036
8. Mohan has ₹ 10000 investment & prabhu has 20000; Mohan earns a
profit. 10%, and the remaining amount is divided in proportion to their Shark
amount, what is the final distribution on result?
A. 40% : 60% B. 50% : 50% C. 60% : 40% D. 30% : 70%
Solution:
M & P investement ratio, 10000 : 20000
= 1 : 2 Mohan earns a profit of 10%.
Remaining 90%, of profit to M & P = 1x+2x =
90% of p, 3x = 90%, of p
x = 30%, of p
M earn the profit 30%+10%.
= 40%, P earn the profit
60%.
Answer: 40% : 60%
9. If the speed of the bike is 49kmph and it's reduced by 46%, what is the
new speed of the bike?
A. 26.46 km/h B. 27 km/h C. 28 km/h D. 30 km/h
Solution:
Reduced. Speed 46%. After the
speed 54% 54%. of 49 = 26.46kmph
Answer: 26.46kmph
10. Ram and Shyam start a journey towards the same destination. Ram
travels at speed 15kmph while Shyam travels at 14kmph. When Ram reaches
the destination shyam is still 42min away from reaching it. Find the total
distance of the journey
A. 147 B. 138 C. 128 D. 137
Solution:
Ram speed
15kmph Shyam
speed 14kmph
D/14 – D/15 =
42min
(15D – 14D)/ 14*15 =
42/60 hrs D = (42*14)/4
= 147km
Answer: 147km
11. The average of 10 number, was found to be 40 later on. It was
detected the number 40 was misread as 39, find the Correct average of
the number?
A. 40.1 B. 40.5 C. 41 D. 39.9
Solution:
Total value = 10×40=400
It's Stated that the number 4 was
misread as 39. Correct sum =
400-39+40 = 401
New Average = 401/10 =
40.1, Answer: 40.1
12. Two men can complete a job 13 days, then how many men can complete a
job in 15 days?
A. 1 B. 2 C. 3 D. 4
Solution:
M1 * D1 = M2 *
P2 2 * 13 = M *
15
M = 26/15 = 1.7
Answer: 1.7 days (Since the number of men cannot be a fraction, we round up
to the nearest whole number. Thus, 2 men are needed to complete the job in 15
days)
13. Two men can complete a job 13 days, then how many days will take to
complete a job by 13 men?
A. 1 day B. 2 days C. 3 days D. 4 days
Solution:
D1 * M1 = D2 *
M2 13 * 2 = D
* 13
D = 2 days
Answer: 2
days
14. The difference between the SI on ₹ 9000 and ₹5800 for 3 years is ₹360,
what the rate of interest?
A. 3% B. 3.5% C. 3 3/4% D. 4%
Solution:
(9000 x R x 3)/100 -
(5800XRX3)/100 = 360. 9600 R =
36000
R = 3.75%. (04) 3 3/4%.
Answer: 3 3/4%
15. The difference between CI & SI on certain amount over 3 years is 24500.
If x is 8% of CI and 2x is 9% of SI over the same period find the value of x?
A.79032 B. 49032 C. 28878 D. 69042
Solution:
Given, x = 8% of CI:
X = 0.08 * CI = 0.08 * 0.259712P
Substituting P = 2,382,000: [ P = 24500/ -
0.010288 = 2,382,000] X = 0.08 * 0.259712 *
2,382,000 = 49,032
X = 49032
Answer: 49032
16. f(x) = 3+ |3(x)+2| find minimum value
a.4 b.3 c.0
d.2
Solution:
The function has an absolute value term ∣3x+2∣. To minimize the entire function,
we need to minimize the expression inside the absolute value.
The absolute value function ∣y∣ reaches its minimum when y=0. Therefore, we
need to solve for xxx where the expression inside the absolute value is zero:
3x+2=0
Solving x, 3x = -2, x = -2/3
Find value of x, f(-2/3) = 3 + |3(-2/3) + 2|
F(-2/3) = 3 + |0| = 3 + 0 = 3, Therefore f(x) is 3
Answer: 3
17. When the Radius of the sphere is 15cm what is the total surface area of
the sphere?
A. 2828.57 cm² B. 3000 cm² C. 2500 cm² D. 2800 cm²
Solution:
R = 15
T.S.A = 4πr^2 = 4 * 22/7 * 15 * 15 = 2828.57cm^2 (or) 900π
Answer: 2828.57 cm² (or) 900π
CODE QUESTIONS
1. Write a program that generates a list L containing numbers from 0 to
10000. The program should take two integers i and j as input, representing the
starting and ending indices of the list. Your task is to calculate and print the
sum of the elements from index i to j, inclusive.
Input Format:
•Two integers i and j, separated by a space.
Output Format:
•A single integer representing the sum of elements from index i to j.
Sample Input:
37
Sample Output:
25
Explanation:
The list L contains numbers from 0 to 10000:
L = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, ... 10000]
We are asked to find the sum of elements from index 3 to 7,
inclusive. Elements from index 3 to 7 are:
3 + 4 + 5 + 6 + 7 = 25
Java Code
import [Link];
import [Link];
public class Main {
public static void main(String[] args) {
Scanner scanner = new
Scanner([Link]);
int start =
[Link](); int
end = [Link]();
int result = [Link](start,
end).sum(); [Link](result);
[Link]();
}
}
2. Problem Statement:
You are given three integers (a, b, c). You can perform the following operation
any number of times: Select any two numbers and increase both by 1, and the
third number (not selected) decreases by 1.
Your task is to find the minimum number of operations required to make all
three numbers equal. If it is not possible, print -1.
Input Format:
•The first line contains an integer n, the number of test cases.
•For each test case, there are three integers a, b, c separated by space.
Output Format:
•For each test case, print the minimum number of operations required to make
all numbers equal.
•If it is not possible, print -1.
Sample Input:
112
444
373
123
Sample Output:
-1
-1
Java Code
import
[Link];
public class Main {
public static int max(int x, int y) {
return [Link](x, y);
public static int min(int x,
int y) { return
[Link](x, y);
public static void answer(int a, int
b, int c) { int t1 = max(max(a,
b), c);
int mx, mn, mid, count =
0; while (!(a == b && b
== c)) {
mx = max(max(a, b), c);
mn = min(min(a, b),
c); mid = a + b + c -
mx - mn;
a = mx - 1;
b = mn + 1;
c = mid +
1;
count++;
if (mn > t1) {
[Link](
"-1"); return;
[Link](count);
public static void main(String[]
args) { Scanner sc = new
Scanner([Link]); int n =
[Link]();
for (int i = 0; i < n;
i++) { int a =
[Link]();
int b =
[Link]();
int c =
[Link]();
answer(a, b,
c);
}
[Link]();
1. Minimum Team Selection to Cover
Required Skills Problem Statement:
You are given a list of required skills and a list of candidates, where each
candidate has a subset of skills. Your task is to find the smallest possible team
such that all required skills are covered.
You will be given:
1. Required skills list
2. Number of candidates (N)
3. Skillsets of N candidates
Return the indices of selected candidates forming the
smallest team. Example:
Input: a b c d, 4, a b, b c,
c d, d Output: 0 2
Input: a b c, 3, a,
b c, c output: 0 1
Java Code:
import [Link].*;
public class Main
public static void main(String[]
args) { Scanner sc = new
Scanner([Link]); String[]
skills = [Link]().split(" ");
int n = [Link]();
[Link]();
String[] candidates = new String[n];
for (int i = 0; i < n; i++) {
candidates[i] = [Link]().replaceAll("\\s+", "");
}
List<Integer> team = findMinimumTeam(skills, candidates);
[Link]([Link]() ? "No valid team found" :
[Link]().replaceAll("[\\[\\],]", ""));
public static List<Integer> findMinimumTeam(String[] skills, String[]
candidates) { Map<Character, Integer> skillMap = new
HashMap<>();
for (int i = 0; i < [Link]; i++)
{ [Link](skills[i].charAt(0), 1
<< i);
int requiredMask = (1 <<
[Link]) - 1; int[] masks =
new int[[Link]]; for
(int i = 0; i < [Link];
i++) {
for (char c :
candidates[i].toCharArray()) {
masks[i] |=
[Link](c, 0);
return findTeam(0, 0, requiredMask, masks, new ArrayList<>());
private static List<Integer> findTeam(int index, int currentMask, int
targetMask, int[] masks, List<Integer> team) {
if (currentMask == targetMask) return new ArrayList<>(team);
if (index == [Link] || ![Link]() && [Link]() >=
[Link]) return null; [Link](index);
List<Integer> withCurrent = findTeam(index + 1, currentMask |
masks[index], targetMask, masks, team);
[Link]([Link]() - 1);
List<Integer> withoutCurrent = findTeam(index + 1, currentMask,
targetMask, masks, team); if (withCurrent == null || (withoutCurrent !=
null && [Link]() <
[Link]())) {
return withoutCurrent;
return withCurrent;
2. Single Number
You are given a non-empty array of integers nums, where every element appears
twice except for one unique element.
Your task is to find that single unique
element. Input Format:
•The first line contains an integer n (size of the array).
•The second line contains n space-separated integers representing the array
elements.
Output Format:
•A single integer representing the unique element that appears only once.
Constraints:
•1 <= [Link] <= 3 * 10^4
•-3 * 10^4 <= nums[i] <= 3 * 10^4
• Every element appears exactly twice, except for one unique element that
appears only once. import [Link];
Java Code
public class Main {
public static void main(String[] args) {
Scanner scanner = new
Scanner([Link]); int n =
[Link]();
int[] nums = new int[n];
for (int i = 0; i < n; i++) {
nums[i] =
[Link]();
int result =
singleNumber(nums);
[Link](result);
[Link]();
public static int singleNumber(int[]
nums) { int result = 0;
for (int num : nums)
{ result ^= num;
return result;
3. Find the Odd Occurring Element
Given an array of integers where every element appears an even number of
times except one element that appears an odd number of times, write a Java
program to find that odd occurring element in O(log n) time.
The array must satisfy the following condition:
• The equal elements must appear in pairs, and no element can
appear more than two consecutive times.
•If the input is invalid, print "Invalid Input".
Input Format:
•The first line contains an integer n (size of the array).
•The second line contains n space-separated integers.
Output Format:
•Print the odd occurring element if the input is valid.
•Otherwise, print "Invalid Input".
Java Code
import [Link].*;
public class Main
public static void main(String[]
args) { Scanner sc = new
Scanner([Link]); int n =
[Link]();
int[] arr = new int[n];
for (int i = 0; i < n;
i++) { arr[i] =
[Link]();
if (!isValidInput(arr)) {
[Link]("Invalid
Input"); return;
[Link](findOddElement(arr));
public static boolean
isValidInput(int[] arr) { for (int i
= 0; i < [Link] - 2; i++) {
if (arr[i] == arr[i + 1] && arr[i + 1] ==
arr[i + 2]) { return false;
return true;
public static int findOddElement(int[] arr) {
Map<Integer, Integer> countMap = new
HashMap<>(); for (int num : arr) {
[Link](num, [Link](num, 0) + 1);
for (int key : [Link]()) {
if ([Link](key) % 2 !=
0) { return key;
return -1;