Company Interview Questions · IT Services

Cognizant: GenC (AI/ML Track) Interview

❓ 6 questions🏢 Cognizant🆕 Recent reports

Cognizant: GenC (AI/ML Track) and GenAI Interview Experience (2025–26). Rounds, real reported questions and model answers, compiled from public candidate reports (sources at the end). Practice mode hides every answer: say your answer first, press Show answer, then rate yourself. Use 🔁 Review again to build your revision list and 🎲 Random question for a quick drill.

About this interview

Compiled from public candidate reports for Cognizant GenC (Generation Cognizant) interviews, including candidates with AI/ML backgrounds (Chennai, March 2025 – June 2026). The questions are paraphrased, and the model answers are written by EasyLearnSpace.

Roles GenC / GenC Next (fresher and early career); Python / AI-ML cluster
Rounds Online assessment (aptitude, logical, verbal, basic coding) → technical interview → HR
What gets asked Python coding, OOP, DBMS / SQL joins, OS, basic ML, a deep dive into your projects
Reported outcomes Offers for candidates who were strong on projects and fundamentals; several rejections after short technical rounds
Tip The interviewer follows your resume: if you list ML, Python or SQL, expect questions on them

01Rounds at a glance

02Questions and model answers

Q1
Write a function that checks whether a number is prime.
def is_prime(n: int) -> bool:
    if n < 2: return False
    if n % 2 == 0: return n == 2
    i = 3
    while i * i <= n:
        if n % i == 0: return False
        i += 2
    return True
  • Checking divisors only up to √n gives O(√n). For many numbers at once, mention the Sieve of Eratosthenes, which is O(n log log n).
Q2
Implement merge sort and give its complexity.
def merge_sort(a):
    if len(a) <= 1: return a
    m = len(a) // 2
    L, R = merge_sort(a[:m]), merge_sort(a[m:])
    out, i, j = [], 0, 0
    while i < len(L) and j < len(R):
        if L[i] <= R[j]: out.append(L[i]); i += 1
        else: out.append(R[j]); j += 1
    return out + L[i:] + R[j:]
  • O(n log n) in every case, O(n) extra space, and stable (equal items keep their order). Quicksort averages O(n log n) and sorts in place, but its worst case is O(n²).
Q3
Explain the four pillars of OOP, and what a wrapper class is.
  • Encapsulation: bundle data with the methods that use it, and hide the internals behind a clear interface.
  • Abstraction: expose what an object does, not how (abstract classes and interfaces).
  • Inheritance: a child class reuses and extends a parent class.
  • Polymorphism: one interface, many implementations (method overriding, duck typing in Python).
  • Wrapper class (Java): an object version of a primitive (int → Integer) so it can be used in collections; autoboxing converts between them. In Python the general idea is a class that wraps another object to add behaviour, such as a decorator or adapter.
Q4
What are SQL joins? Write a query for employees without a department.
  • INNER JOIN returns matching rows only. LEFT JOIN returns all left rows plus matches (NULL where there is none). RIGHT JOIN is the mirror image. FULL OUTER JOIN returns all rows from both sides.
SELECT e.emp_id, e.name
FROM employees e
LEFT JOIN departments d ON d.dept_id = e.dept_id
WHERE d.dept_id IS NULL;
  • This is the "anti-join" pattern. NOT EXISTS is an alternative that handles NULLs more safely than NOT IN.
Q5
Explain your AI/ML project in depth.

Answer (a 3-minute structure):

  1. Problem and data: "Predict loan default from 50k applications with 30 features."
  2. Approach: cleaning (missing values, outliers), features, a baseline logistic regression, then XGBoost, with stratified cross-validation.
  3. Result: "AUC 0.84 against a 0.76 baseline; recall of 0.71 at 0.8 precision."
  4. Your part: "I built the feature pipeline and the Streamlit demo."
  5. What you'd improve: "Calibration, SHAP explanations and deployment with FastAPI." - Expect follow-ups such as "why XGBoost?", "how did you handle imbalance?" and "what is AUC?". Know every line of your resume.
Q6
What is the difference between supervised and unsupervised learning? Give examples.
  • Supervised: you learn from labelled examples (X → y).
  • Classification: spam detection, churn.
  • Regression: price prediction.
  • Algorithms: linear and logistic regression, decision trees, random forests, SVM, neural networks.
  • Unsupervised: there are no labels; you find structure in the data.
  • Clustering: customer segments with k-means.
  • Dimensionality reduction: PCA.
  • Anomaly detection.
  • Also mention: semi-supervised learning, self-supervised learning (how LLMs are pre-trained), and reinforcement learning (rewards).

03How to prepare for Cognizant

Sources

Created by Ajeetkumar