Tcs Coding Questions 2021 |work| May 2026

Tcs Coding Questions 2021 |work| May 2026

TCS Coding Questions 2021: A Complete Analysis

Introduction

In 2021, Tata Consultancy Services (TCS) continued its robust hiring through the TCS National Qualifier Test (NQT) and other off-campus/on-campus drives. The coding section remained a critical differentiator for securing an interview call. This write-up analyzes the nature, difficulty, topics, and sample problems from TCS coding questions asked in 2021.

Easier 2021 version (most common):
Given a binary string, find the number of groups of consecutive 1's. Tcs Coding Questions 2021

// 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];

9. Compute sum of digits until single digit (digital root)

Input: 9875 → 9+8+7+5=29 → 2+9=11 → 1+1=2.
Concept: Recursion or formula 1 + (num-1)%9. TCS Coding Questions 2021: A Complete Analysis Introduction

  • First line: Integer N (Size of array).
  • Second line: N space-separated integers.

Example:

8. Find if two strings are anagrams

Input: "listen", "silent" → Yes.
Concept: Sort and compare OR frequency count of 26 characters. First line: Integer N (Size of array)

Go to Top