Cognizant Interview Questions: Technical and HR Model Answers
Prepare clear technical and HR responses through worked programming, SQL, project and STAR examples, then test them in a timed self-review mock.
KnowledgeGate Team
Exam prep & CS education

You may know Java, SQL and your project, yet lose clarity when a definition leads to follow-ups or an HR answer contradicts your resume. This guide gives representative technical and HR question shapes, answer structures and a timed mock. Your current invitation controls the actual format. Company-Specific Placement Courses provide a wider preparation path.
Cognizant interview questions: build a preparation map, not a predicted paper
Question family | What the interviewer can probe | Evidence the candidate should show |
|---|---|---|
Programming and problem solving | Correctness, complexity, edge cases | Trace plus tested pseudocode |
CS fundamentals | Definition, comparison, practical consequence | One example and one trade-off |
SQL and DBMS | Query logic, duplicates, NULLs, transactions | Result table before syntax |
Resume and project | Ownership, decisions, measurements | Architecture plus honest contribution |
HR and situational | Motivation, communication, consistency | Specific evidence without a memorised speech |
“Technical round” and “HR round” are preparation buckets, not a fixed live sequence. The current role posting, invitation and recruiter message outrank generic guides.
The Cognizant Superset Course offers structured company-focused preparation. Capgemini technical interview preparation and the Infosys interview preparation by stage guide show adjacent ways to organise study.
Programming model answer: first value that occurs once
Practice stem: Given nums = [4, 1, 4, 2, 1, 3], return the first value whose total frequency is 1 when the array is scanned from left to right. Return -1 if no such value exists.
First clarify that “first” means first in the original array order, not the smallest numeric value. Then propose two passes. The frequency pass produces {4: 2, 1: 2, 2: 1, 3: 1}. The second pass checks 4 -> count 2, 1 -> count 2, 4 -> count 2, then 2 -> count 1. Return 2 without reaching 3.
frequency = map with default count 0
for value in nums:
frequency[value] += 1
for value in nums:
if frequency[value] == 1:
return value
return -1This takes O(n) time and O(k) auxiliary space for k distinct values. Speak three tests aloud: [7, 7] -> -1, [5] -> 5, and [9, 8, 9, 8, 6] -> 6. Sorting can group duplicates, but it loses original position unless you retain extra data, and it costs O(n log n). The complete answer pattern is clarify -> state approach -> trace -> complexity -> edge cases.

SQL and CS fundamentals: explain the result before the definition
Practice stem: For Employee(id, name, dept_id, salary), return the second-highest distinct salary in each department.
id | name | dept_id | salary |
|---|---|---|---|
1 | Asha | 10 | 60000 |
2 | Ravi | 10 | 75000 |
3 | Meera | 10 | 75000 |
4 | Kabir | 20 | 90000 |
5 | Nitin | 20 | 70000 |
6 | Sara | 20 | 65000 |
Derive the result first. Department 10 gives 60000 because duplicate 75000 values occupy one distinct rank. Department 20 gives 70000.
WITH ranked AS (
SELECT dept_id, salary,
DENSE_RANK() OVER (
PARTITION BY dept_id ORDER BY salary DESC
) AS salary_rank
FROM Employee
)
SELECT DISTINCT dept_id, salary
FROM ranked
WHERE salary_rank = 2
ORDER BY dept_id;ROW_NUMBER would split the tied Ravi and Meera rows. RANK would number both 75000 rows as rank 1 and 60000 as rank 3. A department with one distinct salary returns no row unless the requirement defines a fallback.
For fundamentals, use definition -> decisive contrast -> example -> trade-off:
Process versus thread: cover address-space ownership, resource sharing and failure isolation.
Interface versus abstract class: cover contract, shared state and multiple-type relationships.
TCP versus UDP: cover connection setup, delivery guarantees and one suitable use case.
For each answer, state the result before the syntax, then explain the decisive contrast and its practical consequence.
Resume and project questions: defend one decision with evidence
A fictional four-person team built an issue-tracker API with 1,000,000 seeded ticket rows. In a 10-minute test with 100 concurrent clients, GET /tickets?status=open&sort=created_at had p95 latency of 480 ms. An index on (status, created_at DESC) and cursor pagination with page size 50 reduced it to 170 ms in the same test.
Build the response in four moves:
Problem: Name the slow endpoint and test conditions.
Decision: Explain that the index matches the filter and sort, while cursor pagination avoids large offsets.
Evidence: Show
480 - 170 = 310 ms, then310 / 480 × 100 = 64.583%, or about64.6%reduction.Trade-off: The index takes storage and can increase write cost, so inspect query plans and test write latency too.
Expect: How did you measure p95? What did EXPLAIN show? Why not cache it? What if two rows share created_at? Which tasks did you own? Use (created_at, id) for a deterministic cursor. Admit a gap and give a verification step instead of bluffing. Finish by naming the trade-off and the check that would validate it.

HR questions: keep every answer specific and consistent
Use four frames instead of memorised speeches:
Tell me about yourself: present role or degree, two skills, one evidence point, then why this role. Set a
60-75 secondpractice limit.Why Cognizant?: one current role requirement, one verified fact from the live official role or careers page, then matching evidence. Omit unverified facts.
What is your weakness?: a real non-fatal gap, the correction system, then recent evidence.
Are you open to relocation or shifts?: give your true constraint and earliest feasible date, not an automatic yes.
For fictional STAR practice, answer: Tell me about a time your team found a serious defect close to a deadline. A four-person capstone team had a Friday demo, but a CSV import rejected 60 of 200 rows. To diagnose it without hiding invalid data, the candidate reproduced a failure, added field-level validation and logging, split parser tests and UI error handling, then reran all rows.
The result was 196 valid rows imported and 4 genuinely malformed rows isolated with reasons. The arithmetic is 200 - 196 = 4. Of the original 60 rejections, 60 - 4 = 56 were valid rows rejected incorrectly, and 196 + 4 = 200. Quantify the result, account for every row, separate what you did from what the team did, and use HR interview questions for freshers for more answer structures.
Run a 50-minute practice interview
Allocate 5 minutes to the introduction and resume, 10 to the project, 8 each to programming and SQL, 6 to fundamentals, 5 each to STAR and HR, and 3 to candidate questions. Check: 5 + 10 + 8 + 8 + 6 + 5 + 5 + 3 = 50 minutes.
Score correctness, structure, evidence and follow-up resilience from 0 to 2. Maximum: 4 × 2 = 8. Here, 0 = missing or wrong, 1 = partly clear or incomplete, 2 = correct, specific and defensible. Review and repeat answers below 6 without notes after one day.
Mistake | Failure | Repair |
|---|---|---|
Memorise a script | Follow-ups expose shallow understanding | Retain an answer outline and vary the wording |
Claim team work as personal work | Ownership becomes inconsistent | Separate “I” and “we” |
Write code before clarifying “first” | Solve the wrong ordering requirement | Restate input and output |
Quote a company fact from memory | Risk an outdated or false claim | Verify it on a live official source |
Answer an unknown with a bluff | Contradictions multiply | State the gap and describe how you would verify it |
Use the rubric to choose the lowest-scoring answer, apply the matching repair, and repeat it without notes.
Cognizant interview questions: the short version and next step
Programming: trace before code.
SQL: expected rows before syntax.
Fundamentals: contrast plus consequence.
Project: decision plus measured evidence.
HR: truthful example plus reflection.
Recall the worked outputs: first unique value 2; second-highest salaries 10 -> 60000 and 20 -> 70000; project p95 480 ms -> 170 ms; CSV result 196 valid + 4 malformed = 200.
Record one 50-minute mock, score each answer out of 8, and rewrite the weakest two. Then use the Cognizant course above for company-focused work or the Interview and Resume Preparation Course for broader rehearsal.
Keep learning

Accenture Coding Questions: 4 Patterns with Solved Dry Runs
Stop memorising company-question lists. Learn four reusable coding patterns through precise examples involving strings, arrays, digits, and matrices.

Accenture Placement Preparation: 4-Week, 56-Hour Study Plan
Turn four preparation lanes into a practical weekly calendar. Start with a baseline, move hours towards your errors, and recover missed sessions without cramming.

Capgemini Interview Questions: Technical and HR Rounds with Model Answers
Practise clear technical and HR answers through Java, SQL, a coding trace and one consistent project story. Each example shows what to say and how to support it.

Capgemini Drive Mistakes: Stage-by-Stage Rejection Risks and Fixes
Diagnose the controllable evidence gaps behind common Capgemini drive risks. Repair your CV, timed practice, code traces, project proof and behavioural stories with worked drills.