Tcs Coding Questions 2021 Jun 2026
// For smallest if(arr[i] < first_small) second_small = first_small; first_small = arr[i]; else if(arr[i] < second_small && arr[i] != first_small) second_small = arr[i];
To prepare for the TCS coding test, focus on the following topics: Tcs Coding Questions 2021
def reverse_string(s): letters = [ch for ch in s if ch.isalpha()] letters.reverse() result = [] idx = 0 for ch in s: if ch.isalpha(): result.append(letters[idx]) idx += 1 else: result.append(ch) return ''.join(result) // For smallest if(arr[i] < first_small) second_small =
Example: 45 → 45² = 2025 → split 20 + 25 = 45 → Yes. Square, convert to string, split, sum, compare. // For smallest if(arr[i] <
: Palindrome checks, counting vowels and consonants, and anagram detection. Number Theory
Good luck with your TCS preparation!
The TCS coding test may include a variety of question types, such as: