TCSNQT25 March 2025 S 2
TCSNQT25 March 2025 S 2
com
TCS Pattern:
Section Total Time Total Questions
Part A: Foundation Section
Numerical Ability 25 mins 20 Q
Verbal Ability 25 mins 25 Q
Disclaimer:
1. The questions in this document have been reconstructed from memory by test takers who
recalled them after their exam.
2. There is minimal repetition of questions between different slots.
3. Use this document as a reference for preparation rather than a replica of the questions that
have appeared or may appear in the TCS NQT.
1. 2 men can do a work in 14 days. Then find how many men are required to finish the work
in 4 days?
Answer: 7 men
4. A man sold a toy for Rs.10620 but incurred a loss of 10%, if he wants to gain a profit of
12% then how much he has to sell?
Answer: 13216
5. A man age present age is two and half times of sum of ages of his two daughters. 30 years
later his age will the sum of ages of his two daughters. Then what will be man ages in 12
years from now?
Answer: 62
7. find the largest value that divide 639 and 1468 that leaves remainder 4 and 3 is:
a) 25 b) 5 c) 45 d) 15
Answer: 5
9. One interesting questions was if L, N, M are mode, median and mean then which of the
following is correct?
Answer: L = 3N-2M
10. In a class average marks of 12 students is 36. If the marks of each student become
double, what will be the average?
Answer: 72
11. A rectangle have area of 154 cm^2. Its length is 4 times + 4 cm of breath. What would be
the quadratic equation of this?
Answer:
lb=154, l=4b+4
(4b+4)b = 154
4b2+4b−154=0
2b2+2b−77=0
Question-1
First Non-Repeating and Most Frequent Character
1. Find the first non-repeating character in the string. If no non-repeating character exists,
return "None".
2. Find the most frequent character in the string. If all characters are unique, return the first
character.
You must consider case-sensitive characters (i.e., 'a' and 'A' are different).
Input Format:
• The string consists of lowercase and uppercase English letters (a-z, A-Z).
Output Format:
Input: swadesh
Output: w s
Java Code:
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
String s = scanner.next();
System.out.println(findCharacters(s));
scanner.close();
}
}
Shift - 1
Question-2
Write a program that takes a user's total income (in dollars $) and a series of expenses. The
program should then calculate:
• Total income
• Total expenses
The user should enter "done" to indicate that they have finished entering expenses.
Input Format:
Output Format:
2. Expense breakdown with each category and the amount spent ($).
Constraints:
• 1 ≤ income ≤ 10^6
Input:
1000
food
200
transport
150
done
Java Code:
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
int income = scanner.nextInt();
Map<String, Integer> expenses = new LinkedHashMap<>();
int totalExpenses = 0;
while (true) {
String expenseType = scanner.next();
if (expenseType.equalsIgnoreCase("done")) {
break;
}
int price = scanner.nextInt();
expenses.put(expenseType, expenses.getOrDefault(expenseType, 0) + price);
totalExpenses += price;
}
int totalSavings = income - totalExpenses;
System.out.println("Summary of expenses:");
System.out.println("Total income: " + income + "$");
System.out.println("Total expenses: " + totalExpenses + "$");
System.out.println("Total savings: " + totalSavings + "$");
System.out.println("Analysis:");
System.out.println("Expense and price:");
for (Map.Entry<String, Integer> entry : expenses.entrySet()) {
System.out.println(entry.getKey() + ": " + entry.getValue() + "$");
}
scanner.close();
}
}
Question-1
You are given an array of numbers and two integers, X and Y, which define a range. Your
task is to count the number of valid pairs (i, j) where:
The numbers at index i and j (which can be the same) are concatenated as strings.
The resulting concatenated number should lie within the range [X, Y] (inclusive).
You must count all valid pairs, including duplicate values (not just unique pairs).
Input Format:
1. The first line contains two space-separated integers: X and Y.
2. The second line contains space-separated integers representing the array.
Output Format:
Print a single integer representing the count of valid concatenated pairs.
Input:
10 500
12345
Step-by-Step Explanation:
Given X = 10 and Y = 500, we take the array:
[1, 2, 3, 4, 5]
We generate all concatenated numbers:
Since all concatenated values fall within [10, 500], we count 25 valid pairs.
Correct Output:
25
Java Code:
import java.util.*;
public class Main {
public static int countValidPairs(int[] arr, int X, int Y) {
int count = 0;
for (int i : arr) {
for (int j : arr) {