Tcs Coding Questions 2021 [exclusive] Official
: Prime numbers, GCD/LCM, series generation (Fibonacci, Leap years, custom series), base conversions, and digit manipulation.
In 2021, TCS National Qualifier Test (NQT) coding questions typically focused on fundamental programming logic, string manipulation, and mathematical series. Candidates were generally required to solve within a shared time limit of 30–45 minutes . Core Topics and Question Types
def candy_jar(m): n = 10 k = 5 if m <= 0 or m > (n - k): print("INVALID INPUT") print(f"NUMBER OF CANDIES LEFT: n") else: print(f"NUMBER OF CANDIES SOLD: m") print(f"NUMBER OF CANDIES LEFT: n - m") # Example Input m = int(input().strip()) candy_jar(m) Use code with caution. Question 2: Keyword Checker (String Matching)
An analysis of the 2021 slot papers shows that TCS heavily favors mathematical logic and basic array manipulations over complex abstract data types for the Ninja role, while Digital tests require strong algorithmic optimization. Topic Category Sub-topics Covered Frequency Weightage Number theory, GCD/LCM, Prime checks, Base conversions Array Manipulations Matrix rotations, subarray sums, sliding window, sorting String Engineering Palindromes, anagrams, regex-like matching, tokenization Advanced Data Structures Trees, Graphs, Dynamic Programming (Digital Track) 3. Top 2021 TCS Coding Questions with Solutions Tcs Coding Questions 2021
| Section | Questions | Duration | |---|---|---| | Verbal Ability | 24 Questions | 30 minutes | | Reasoning Ability | 30 Questions | 50 minutes | | Numerical Ability | 26 Questions | 40 minutes |
Three trainees are running a 3-round fitness test. The oxygen level of each trainee is recorded after each round. Evaluate the average oxygen level of each trainee over the 3 rounds. Select the trainee with the highest average oxygen level.
def rearrange_array(arr): even = [x for x in arr if x % 2 == 0] odd = [x for x in arr if x % 2 != 0] return even + odd # Example Usage arr = [1, 2, 3, 4, 5, 6] print(rearrange_array(arr)) # Output: [2, 4, 6, 1, 3, 5] Use code with caution. 4. Tips to Crack TCS Coding Tests : Prime numbers, GCD/LCM, series generation (Fibonacci, Leap
Involved story-based problems, complex data structures, or optimization techniques like Dynamic Programming. Time allotted was generally 30–45 minutes. Top 5 TCS Coding Questions from 2021
Mastering TCS Coding Questions 2021: Your Ultimate Preparation Guide
Question 4: Maximum Product Subarray (Advanced Data Structures — TCS Digital) Core Topics and Question Types def candy_jar(m): n
#include<bits/stdc++.h> using namespace std;
Predefined Keywords: "break", "case", "continue", "default", "defer", "else", "for", "func", "goto", "if", "return", "struct", "switch", "type", "var" defer Use code with caution. Output: defer is a keyword Use code with caution. Optimized Solution (Python)