Company Corner

TCS CodeVita Mock Questions and Preparation Guide 2026

TCS CodeVita contest structure, practice problems with step-by-step solutions, and a topic-by-topic preparation plan for engineering students targeting the 2026 season.

By FACE Prep Team 7 min read
tcs codevita coding-contest competitive-programming placement-prep tcs-prime algorithms

TCS CodeVita’s practice round (MockVita) uses the same interface and problem format as the qualifying round. Working through it is the most direct preparation you can do.

The 2018 dates in this URL’s original title are historical. This guide is for the 2026 season: what the contest tests, how it differs from the NQT, three worked practice problems, and a preparation roadmap.

How CodeVita Differs from TCS NQT

The TCS NQT aptitude test is a structured MCQ assessment: verbal ability, numerical reasoning, and an advanced coding section with 2 problems in 45 minutes. Your NQT score determines the offer track:

TrackCTC Band
TCS Ninja₹3.5 to 3.9 LPA
TCS Digital₹7.0 to 7.5 LPA
TCS Prime₹9.0 to 11.0 LPA

CodeVita is a different kind of gate. It is a competitive programming contest (no MCQs, no aptitude sections, no verbal component). Your rank is determined entirely by how many test cases your programs pass across 6 problems in 6 hours. The problems are open-book: you can research and reference material freely during the contest, though any borrowed code must be declared.

For the TCS Ninja questions and pattern track, the NQT is the only relevant route. For students who want a coding-first path to TCS Digital or Prime, CodeVita is the alternative. The two routes are not mutually exclusive; you can attempt both in the same placement cycle.

Season 13 (2026) drew 146,922 participants, earning TCS a Guinness World Record for the largest coding contest globally. The qualifier round is the widest funnel; the zonal and finale stages narrow to a small fraction of that field.

What Topics CodeVita Actually Tests

CodeVita problems fall into six recurring categories, across all rounds from qualifier to finale:

  • Number theory — prime sieves, modular arithmetic, digit properties, GCD/LCM variants. Appears in every round.
  • Dynamic programming — longest subsequences, path counting, knapsack variants, partition problems. Highest frequency in zonal and finale rounds.
  • String algorithms — pattern matching, palindrome detection, anagram grouping. Qualifier and zonal staples.
  • Graph traversal — BFS, DFS, shortest-path variants, connected components. Appears from zonal onwards.
  • Combinatorics — counting arrangements, inclusion-exclusion, basic probability. Often combined with number theory.
  • Geometry — area calculations, point-in-polygon, convex hull. Occasional; more common in finale than qualifier.

The qualifier round typically has 2 to 3 problems from number theory and strings, 1 to 2 from DP, and 1 from graphs. The finale inverts that ratio: heavy DP and graph weight, with number theory as supporting knowledge rather than the core challenge.

What CodeVita does not test: verbal reasoning, reading comprehension, numerical estimation, or anything from the aptitude track. If you can pass the qualifier-level problems, your fundamentals are in the right place; the rest is pattern recognition built through contest practice.

Three Practice Problems in the CodeVita Style

The problems below are original practice problems designed to reflect CodeVita’s problem format and difficulty range. They are not past CodeVita questions. Work through each before checking the approach.

Problem 1: Digital Root Count (Qualifier Level)

  • Problem statement: Given integers L, R, and K (where K is 1 to 9), count the integers in the range [L, R] that have a digital root equal to K. The digital root of a positive integer is the single digit obtained by repeatedly summing its digits until one digit remains.
  • Example: L = 1, R = 20, K = 1. Answer: 3. The integers 1, 10, and 19 each have digital root 1.
  • Key insight: For any positive integer N, its digital root equals 1 + (N minus 1) mod 9, with one exception: when N is a multiple of 9, the digital root is 9, not 0.
  • Efficient approach:
    • Step 1: Define count(N, K) = the number of integers from 1 to N with digital root K.
    • Step 2: For K from 1 to 8: count(N, K) = floor((N minus K) divided by 9) plus 1, when K is at most N. Otherwise 0.
    • Step 3: For K = 9: count(N, 9) = floor(N divided by 9).
    • Step 4: Answer = count(R, K) minus count(L minus 1, K).
  • Verification:
    • count(20, 1) = floor((20 minus 1) divided by 9) + 1 = floor(19/9) + 1 = 2 + 1 = 3.
    • count(0, 1) = 0 (K = 1 is larger than N = 0).
    • Answer = 3 minus 0 = 3. Integers: 1, 10, 19. ✓

Problem 2: Divisible Pairs (Zonal Level)

  • Problem statement: Given an array of N integers and a number K, count the pairs (i, j) where i comes before j in the array and arr[i] + arr[j] is exactly divisible by K.
  • Example: Array = [2, 5, 3, 8, 1, 4], K = 5. Answer: 3. The three pairs are (2, 3), (2, 8), and (1, 4), with sums 5, 10, and 5 respectively.
  • Key insight: arr[i] + arr[j] is divisible by K when (arr[i] mod K) + (arr[j] mod K) equals K or 0. Each element pairs with elements whose remainder is (K minus its own remainder) mod K.
  • Efficient approach (one pass, linear time):
    • Step 1: Initialise a frequency map: remainder[r] = count of elements processed so far with value mod K equal to r.
    • Step 2: For each new element with remainder r, add frequency[(K minus r) mod K] to the pair count.
    • Step 3: Increment frequency[r] and move to the next element.
  • Trace for example (K = 5):
    • Process 2 (rem = 2): need rem 3, frequency[3] = 0, pairs = 0. Update frequency[2] = 1.
    • Process 5 (rem = 0): need rem 0, frequency[0] = 0, pairs = 0. Update frequency[0] = 1.
    • Process 3 (rem = 3): need rem 2, frequency[2] = 1, pairs = 1. Update frequency[3] = 1.
    • Process 8 (rem = 3): need rem 2, frequency[2] = 1, pairs = 2. Update frequency[3] = 2.
    • Process 1 (rem = 1): need rem 4, frequency[4] = 0, pairs = 2. Update frequency[1] = 1.
    • Process 4 (rem = 4): need rem 1, frequency[1] = 1, pairs = 3. Final answer = 3. ✓

Problem 3: Grid Paths with Blocked Cells (Zonal-Finale Level)

  • Problem statement: Given an M x N grid where some cells are blocked, count the number of distinct paths from the top-left cell to the bottom-right cell, moving only right or down.
  • Example: 3 x 3 grid with the cell at row 1, column 1 blocked (0-indexed). Answer: 2.
  • Key insight: Dynamic programming. Let dp[i][j] = the number of paths reaching cell (i, j). A blocked cell contributes 0 paths.
  • Recurrence:
    • dp[0][0] = 1 (start cell).
    • If cell (i, j) is blocked: dp[i][j] = 0.
    • Otherwise: dp[i][j] = dp[i-1][j] + dp[i][j-1], treating out-of-bounds terms as 0.
  • Trace for 3 x 3 grid with (1, 1) blocked:
    • Row 0: dp[0][0] = 1, dp[0][1] = 1, dp[0][2] = 1.
    • Row 1: dp[1][0] = 1, dp[1][1] = 0 (blocked), dp[1][2] = dp[0][2] + dp[1][1] = 1 + 0 = 1.
    • Row 2: dp[2][0] = 1, dp[2][1] = dp[1][1] + dp[2][0] = 0 + 1 = 1, dp[2][2] = dp[1][2] + dp[2][1] = 1 + 1 = 2.
    • Answer: dp[2][2] = 2. The two paths go across the top row and down the right column, or down the left column and across the bottom row. ✓

How to Build Your Practice Routine

CodeVita preparation is competitive programming preparation. Topic priority order, based on frequency across past seasons from qualifier to finale:

  1. Dynamic programming — start here; DP appears in every round above qualifier level and is the most common differentiator between shortlisted and non-shortlisted scores.
  2. Number theory — prime sieves, modular arithmetic, digital root, GCD/LCM. Most qualifier problems include at least one number theory component.
  3. String algorithms — KMP pattern matching, palindrome techniques, anagram detection. Builds quickly on top of DP fundamentals.
  4. Graph traversal — BFS and DFS are sufficient for most CodeVita graph problems; Dijkstra and Bellman-Ford appear at finale level.

A 10 to 12 week preparation window is realistic for a student with basic programming skills:

  • Weeks 1 to 3: data structures review (arrays, maps, queues, stacks) and basic algorithm patterns.
  • Weeks 4 to 6: dynamic programming — start with 1D DP (Fibonacci variants, coin change), then 2D DP (grid paths, LCS).
  • Weeks 7 to 9: number theory and string algorithms in parallel — Sieve of Eratosthenes, modular inverse, KMP.
  • Weeks 10 to 12: graph problems and full mock contests.

For NQT coding-section practice alongside this (if you are pursuing both routes), the TCS Ninja mock test and TCS coding practice questions cover the aptitude and NQT coding sections specifically.

The MockVita practice round, released by TCS before each CodeVita season, is the single best resource for CodeVita-specific preparation: real interface, real scoring, real problem format.

The 2026 Stakes: Why Coding Depth Matters More This Cycle

TCS reduced its FY27 fresher intake to approximately 25,000, down from 44,000 in FY26. TCS CHRO Sudeep Kunnumal confirmed at the AI Impact Summit in March 2026 that 60% of FY26 fresher hires were AI-skilled, up from 10 to 15% three years ago. The Prime track, at up to ₹11 LPA, is now the AI-skilled tier. Fewer seats, higher bar.

Prime candidates face an AI/data project review in addition to the standard NQT score gate. CodeVita’s problem-solving depth, particularly the DP and graph reasoning developed through contest prep, transfers directly into the kind of structured thinking that AI engineering roles require.

The 60% AI-skilled figure means that building CodeVita-level algorithmic skills alongside applied AI exposure is the combination the Prime track now looks for. TinkerLLM is the lowest-friction entry into that AI layer: ₹299 for a hands-on LLM coding environment where you ship actual prompts, evaluations, and structured outputs rather than watching demos.

Primary sources

Frequently asked questions

Is TCS CodeVita mandatory for TCS placement?

No. Most TCS campus placements go through the NQT route. CodeVita is a separate, optional contest; clearing it earns a direct interview invitation for TCS Digital or Prime, bypassing the NQT queue.

What happens if you reach the CodeVita finale?

All finalists earn an opportunity to intern with TCS Research and Innovation. Top performers receive additional recognition and a fast-track to Prime or Digital role interviews.

What programming languages does CodeVita accept?

Accepted languages typically include C, C++, Java, and Python, among others. The full list and compiler versions are published on the contest welcome page under the Languages tab each season.

How many problems are there in a CodeVita round?

Each round presents 6 programming problems in a 6-hour window. Problems range from straightforward number theory to complex graph and dynamic programming problems.

Is CodeVita harder than LeetCode Hard problems?

Finale-level CodeVita problems are comparable to competitive programming difficulty, harder than standard LeetCode Hard. Qualifier-round problems are approachable for students with solid data structures and algorithms fundamentals.

Can non-CSE students participate in TCS CodeVita?

Yes. CodeVita is open to all engineering branches: CSE, ECE, EEE, IT, mechanical, civil, and others. The only requirement is enrollment in a qualifying graduation or PG programme.

When does TCS CodeVita 2026 registration open?

TCS announces registration dates on the official portal at codevita.tcsapps.com and via TCS social channels. Check there for current-season schedules; the contest typically runs in the second half of the calendar year.

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