Company Corner

TCS NQT Coding Questions and Answers: 2026 Format and Strategy

The TCS NQT coding section gives you 30 minutes and 2 questions. Understand the 2026 format, cutoffs, sample questions with solutions, and prep strategy.

By FACE Prep Team 6 min read
tcs-nqt tcs-ninja coding-questions placement-prep tcs-hiring-2026 c-programming python

The TCS NQT coding section gives you 30 minutes and 2 questions to produce working code from scratch, in whichever of the four permitted languages you choose.

Below: the 2026 format, section-cutoff mechanics, two representative questions with verified Python and C solutions, and a time-split strategy sized for the 30-minute window.

The 2026 Coding Section Format

The TCS NQT coding section sits within Part B (Programming) of the full test. The current pattern:

  • 2 coding questions
  • 30 minutes total
  • Language options: C, C++, Java, Python (your choice; PERL is no longer part of the 2026 format)
  • Online editor with compile-and-run support; you submit before the timer expires
  • Test-case-based scoring: each question has hidden test cases, and marks are proportional to the number your code passes

Candidates who appeared in 2024 and early 2025 rounds report that Question 1 runs easy (basic I/O, string manipulation, or simple array work) and Question 2 runs medium (nested loops, conditional logic, boundary-case handling). That split has been consistent across cohorts.

The test environment is browser-based. You get a code editor, a compile button, and a run button. You can test with custom inputs before submitting. Test-case results are shown as pass/fail counts after submission, so you know immediately whether you’ve cleared all cases or only some.

One update worth noting: the older TCS recruitment pattern allowed PERL. It was removed from the 2024 format onward. If you’ve been preparing from a pre-2024 article, update your setup to one of the four supported languages.

Section Cutoff: What It Means for Your Offer

TCS NQT uses per-section cutoffs, not a single aggregate score. Clearing the coding section cutoff is not optional. A candidate who scores high on Verbal Ability and Numerical Reasoning but falls below the coding threshold does not advance to shortlisting, regardless of total score.

The cutoff percentile is set fresh for each test cycle and is not published in advance. In practice, you need to pass enough test cases to land above the median candidate for that cohort.

Two things directly affect whether you clear it:

  • Fully solving Question 1: An easy question completed end-to-end in 10 to 12 minutes gives full test-case credit and puts you safely above the threshold for that question.
  • Partial credit on Question 2: A medium question you cannot finish in the remaining time still scores if your logic handles the base cases. A solution that fails only on boundary inputs often passes 3 of 5 test cases.

Combine these two, and clearing the section cutoff for Ninja track is achievable with solid fundamentals in one language. Submitting a partially working solution is always better than leaving the editor blank. TCS awards zero for unattempted problems, but even a brute-force attempt that handles basic inputs earns partial credit.

For the full aptitude section breakdown and practice problems, see TCS NQT aptitude questions and solutions.

Representative Coding Questions with Verified Solutions

These questions are representative of the difficulty and format of the TCS NQT coding section. They are not reproduced from a specific exam paper. TCS does not publish official past coding questions.

Question 1 (Easy): Odd and Even Position Digit Sum

Find the absolute difference between the sum of digits at odd positions and even positions, counting from the left starting at position 1.

  • Input: 4567
  • Expected output: 2
  • Explanation: Odd positions 1 and 3 give digits 4 and 6, sum = 10. Even positions 2 and 4 give digits 5 and 7, sum = 12. Difference = |12 - 10| = 2.

Python solution:

num = input().strip()
odd_sum = sum(int(num[i]) for i in range(0, len(num), 2))
even_sum = sum(int(num[i]) for i in range(1, len(num), 2))
print(abs(even_sum - odd_sum))

C solution:

#include <stdio.h>
#include <string.h>
#include <stdlib.h>

int main() {
    char num[105];
    scanf("%s", num);
    int len = strlen(num);
    int odd_sum = 0, even_sum = 0;
    for (int i = 0; i < len; i++) {
        int d = num[i] - '0';
        if (i % 2 == 0) odd_sum += d;
        else even_sum += d;
    }
    printf("%d\n", abs(even_sum - odd_sum));
    return 0;
}

Target time: 8 to 10 minutes. If you’re past 12 minutes on this type of problem, your approach is too complex. Simplify.

Question 2 (Medium): Zero-Padded Range Print

Given two integers m and n where m < n, print all integers from m to n with leading zeros so that each number matches the digit width of n.

  • Input: 5 10
  • Expected output: 05 06 07 08 09 10
  • Input: 9 100
  • Expected output: 009 010 011 ... 100
  • Explanation: Width is the number of digits in n. For n = 10 (2 digits), all numbers print with width 2. For n = 100 (3 digits), width = 3.

Python solution:

m, n = map(int, input().split())
width = len(str(n))
for i in range(m, n + 1):
    print(str(i).zfill(width), end=' ')

C solution:

#include <stdio.h>

int main() {
    int m, n;
    scanf("%d %d", &m, &n);
    int width = 0, temp = n;
    while (temp > 0) { width++; temp /= 10; }
    for (int i = m; i <= n; i++) {
        printf("%0*d ", width, i);
    }
    return 0;
}

Target time: 15 to 18 minutes. Leave 2 to 3 minutes to check the edge case where n has a single digit and no padding is needed.

For a larger set of practice problems at this difficulty, see TCS coding questions with solutions.

30-Minute Time Management Strategy

Thirty minutes for two questions is tight if you re-read the problem statement three times or second-guess your opening approach. A working time split:

  • Minutes 1 to 2: Read both problems before writing a line. Classify difficulty. Question 1 should be your fast solve.
  • Minutes 3 to 13: Solve Question 1 completely. Compile, verify on the sample case, move on.
  • Minutes 14 to 26: Work Question 2. Build the base logic first, then add boundary-case handling.
  • Minutes 27 to 30: Review submissions. If Question 2 is not complete, submit what works.

Two rules that hold across TCS NQT cohorts:

  • Choose Python if you’re equally comfortable in two languages. Python’s built-in string and list methods handle formatting-class problems (like zero-padding) in one line. The equivalent C logic takes 6 to 8 lines. On a 30-minute timer, that difference is measurable.
  • Don’t optimise for time complexity during the NQT session. Input sizes at Ninja difficulty are not large enough to expose an O() loop. A working brute-force that passes all test cases beats an incomplete optimised solution every time.

For the full question bank across NQT sections, see TCS NQT placement papers with solutions.

The AI Dimension in 2026

The standard NQT coding section format is unchanged for 2026. What changed is what comes after it for Digital and Prime track candidates.

TrackBandWhat is different in 2026
TCS Ninja3.5 to 3.9 LPANo change to coding format
TCS Digital7.0 to 7.5 LPAHigher NQT cutoff plus new AI Programming section
TCS Prime9.0 to 11.0 LPATop NQT performance plus AI/data project review required

The broader shift: per TCS CHRO Sudeep Kunnumal at the AI Impact Summit in March 2026, 60% of TCS FY26 fresher hires are AI-skilled, up from 10 to 15% three years ago. TCS has also cut FY27 fresher intake to roughly 25,000 (down from 44,000 onboarded in FY26) with a sharper tilt toward higher-skilled candidates.

For Ninja-track students, clearing the standard NQT coding section remains the priority. For Digital and Prime track candidates, the AI Programming component is now a real differentiator. The 2026 AI roadmap for Indian engineering students maps out what that prep looks like in concrete terms.

With 60% of TCS FY26 fresher hires being AI-skilled, the AI Programming assessment is not a nice-to-have for Digital track selection. If you want to build something demonstrable with LLMs before your next TCS interview, TinkerLLM is where to start: at ₹299, it gives you live LLM API access, and the micro-project you produce is something you can walk a TCS Prime or Digital interviewer through when they ask what you have actually shipped.

Primary sources

Frequently asked questions

How many questions are in the TCS NQT coding section and what is the time limit?

The TCS NQT coding section has 2 questions to be solved in 30 minutes. You choose your preferred language from C, C++, Java, or Python.

Which programming languages are allowed in TCS NQT 2026?

C, C++, Java, and Python are permitted. PERL, which appeared in older TCS tests, is no longer part of the 2026 format.

Is there a section cutoff for TCS NQT coding?

Yes. TCS NQT applies per-section cutoffs. You must score above the coding section threshold to proceed to the technical interview stage.

Are partial test-case marks awarded in TCS NQT coding?

Yes. Partial credit is given for each test case passed. A solution that clears 3 of 5 test cases scores better than a blank submission.

What difficulty level are TCS NQT coding questions?

One question is typically easy (string or array manipulation solvable in under 12 minutes). The second is medium difficulty, requiring iterative logic and careful edge-case handling.

How is TCS Digital coding different from TCS Ninja coding in 2026?

TCS Digital candidates face a higher NQT cutoff and an additional AI Programming assessment added in 2026. The base NQT coding section format is the same across both tracks.

Build AI projects

A self-paced playground for building with LLMs.

TinkerLLM is FACE Prep's sister property. A guided environment for shipping real LLM applications, the kind of project that earns a paragraph on your resume, not a line.

Try TinkerLLM (₹299 launch)
Free AI Roadmap PDF