131 questions Β· from 12 interviews Β· 3 asked more than once
Cognizant interview questions
Every question candidates reported from their Cognizant interviews, most frequently asked first. Each links to the write-up it came from, so you can see the round and how it went.
Cognizant coding and DSA questions
- 01
Reverse a String
Implement a function to reverse a given string. I was initially asked to use StringBuilder and then to re-implement it using a loop to demonstrate logical clarity.
Easy Β· Asked 2 times Β· From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 02
Kth Largest Element
Given an unsorted array, find the Kth largest element. The interview asked me to discuss possible approaches and to implement two of them. I mentioned four approaches: Brute Force, Sorting, Min Heap, and Quickselect, and I coded the Sorting and Min Heapβ¦
Medium Β· From Got placed in Cognizant as a Associate Software Engineer Trainee(campus-placement)
- 03
Rotate Array by K Positions
Rotate an Array by K Positions(Left and Right) π Input: [1,2,3,4,5], k = 2 π Output: [4,5,1,2,3]
- 04
Find Second Largest Element in Array
Find the second largest element in a given array.
- 05
Palindrome Checker
I was asked to write a simple palindrome checker function for a given string.
Easy Β· From Cognizant GenC Interview Experience
- 06
Prime Number Checker
Next, they asked for code to check if a given integer is a prime number.
Easy Β· From Cognizant GenC Interview Experience
- 07
Find Second Largest Salary in SQL without LIMIT
They asked for a SQL query to fetch the 2nd largest salary from an 'employees' table without using the LIMIT clause.
Medium Β· From Cognizant GenC Interview Experience
- 08
Water Jug Puzzle: Measure 4 Litres
This was a classic puzzle: measure exactly 4 litres of water using only a 3-litre jug and a 5-litre jug.
Medium Β· From Cognizant GenC Interview Experience
- 09
Remove Special Characters from a String
Write a program to remove special characters from a string, where the input string is taken from the user.
Easy Β· From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 10
Find Max Consecutive Ones
I was asked to solve the problem to find the maximum number of consecutive 1s in a binary array.
Easy Β· From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 11
Find Sum of Same Consecutive Numbers that occur k times
I was given a coding question to find the sum of numbers that appear consecutively 'k' times in a sequence.
Medium Β· From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 12
Longest Word in a String with Specific Characters
During my technical interview, I received a coding question to find the length of the longest word in a given string. As a follow-up, I also had to print all words that had this maximum length. The interviewer also asked me to consider handling spaces andβ¦
Easy Β· From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 13
SQL Query for 2nd Highest Salary
I was asked to write an SQL query to find the 2nd highest salary from an employee table.
Easy Β· From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 14
HashMap Internal Implementation
Explain what a HashMap is and describe its internal working and implementation details in Java.
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 15
Set vs. List Data Structures
Define what a Set is and explain the key differences between List and Set data structures.
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 16
Merge Two Maps
Given two maps, write code to merge them into a single map. Handle potential key conflicts.
Easy Β· From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 17
Find Duplicate Numbers in Array
From an array, print the numbers which have duplicate values.
- 18
Create SQL Table
Create a table with the attributes the interviewer gave.
- 19
- 20
- 21
Explain SQL JOINs (Left, Right)
Explain JOINS, Left Join, Right Join.
- 22
Implement Array Sorting Algorithm
Write a sorting algorithm (whichever method you want) on an array.
- 23
Explain SQL DROP and TRUNCATE
Explain the difference and use of DROP and TRUNCATE in SQL.
- 24
Transpose Matrix
Given a matrix, write a function to return its transpose. I was asked to solve this during the final interview and successfully did so in C++.
- 25
Compare Leaf Node Sequences of Two Trees (Reverse Second)
There is teacher in a school who have it's 2 favourite childrens. Both her students made a binary tree from same numbers but in diffrent format. The task for teacher is to view 1st student's tree from behind moving from left - right and noted down the numbersβ¦
From Cognizant 2025 On Campus Hiring || Asked 2 Questions from Trees
7 more in the Cognizant write-ups.
Cognizant system design questions
- 01
Project-Specific System Design Discussion
They asked several system design questions related to my personal project, covering its architecture, API handling, database schema, scalability, error handling, logging, user capacity, and security measures.
Hard Β· From Cognizant GenC Interview Experience
Cognizant behavioural and HR questions
- 01
Background about Hometown
Tell me about the city you belong to and provide details about it.
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 02
Willingness to Relocate
Are you willing to relocate for this role?
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 03
Comfort with Shifts
Are you comfortable working in different shifts?
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 04
Adaptability to New Technologies
If new programming languages emerge in the future, will you be able to learn them and adapt?
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 05
SQL Self-Rating
What would you rate yourself on a scale of 1-5 on your SQL skills?
- 06
- 07
Language Flexibility
If in future, you are given to work on any other lang except for Java, are you open to it?
- 08
Shift Flexibility
Can you work in shifts that are not basic?
- 09
Candidate Questions for Interviewer
Any questions for me?
- 10
Behavioral: What did you hate most?
The interviewer asked me: 'What did you hate most?' as a behavioral question.
- 11
Behavioral: Family Background
The interviewer inquired about my family background.
- 12
Behavioral: Opinion on Class Toppers
The interviewer asked: 'What do you think about toppers of your class?'
- 13
Behavioral: Relocation
The interviewer asked some common questions regarding relocation.
- 14
Tell me about yourself.
Introduce yourself and talk about your background and experiences.
- 15
Why should we hire you?
Explain why you are the best candidate for this role and company.
- 16
Why do you want to join Cognizant?
Articulate your reasons for wanting to work specifically at Cognizant.
- 17
Where do you see yourself in the next 5 years?
Describe your career aspirations and how they align with this role and company.
- 18
Are you willing to relocate if required?
Confirm your flexibility and willingness to relocate for the job.
- 19
Are you a team player?
Discuss your experience and approach to working effectively in a team.
- 20
What are your strengths and weaknesses?
Share your professional strengths and areas for improvement, along with how you address weaknesses.
- 21
Handling Irrelevant Projects
What if we assign you a project that is not relevant to your skills?
- 22
Project Discussion
Explain your projects in detail.
- 23
Self-Introduction
Introduce yourself, including your background, education, and interests relevant to the role.
- 24
Discuss Projects and Internships
Detail your past projects and internship experiences, highlighting your contributions and the technologies used.
- 25
Willingness for Night Shifts
Are you willing to work in night shifts if required?
3 more in the Cognizant write-ups.
Cognizant other questions
- 01
Types of SQL Joins
The interviewer asked me to explain all types of Joins available in SQL.
Asked 2 times Β· From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 02
Method Overloading vs. Overriding
Explain the differences between method overloading and method overriding in object-oriented programming.
Asked 2 times Β· From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 03
Difference Between Abstract Class and Interface
The interviewer began by testing my object-oriented concepts, asking for the differences between Abstract Classes and Interfaces.
- 04
JUnit Unit Testing Concepts
They asked basic questions regarding JUnit, including 'What is JUnit?', 'Why do we use unit testing?', 'What is an annotation?', and 'Difference between @Before, @After, @Test'.
- 05
SQL DDL, DML, TCL Commands
I was asked to list and explain examples of DDL (Data Definition Language), DML (Data Manipulation Language), and TCL (Transaction Control Language) commands in SQL.
- 06
Explain OOPs Concepts
Explain the core concepts of Object-Oriented Programming (OOPs) with real-world examples.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 07
Constructors and Overloading
Discuss constructors in Java and explain if they can be overloaded.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 08
Java Collections Framework Overview
Provide an overview of the Java Collections Framework and discuss its common use cases.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 09
HashMap Working and Use Cases
Explain the basic working mechanism of a HashMap and provide scenarios for when to use it.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 10
ArrayList vs LinkedList Performance
Describe the performance differences between ArrayList and LinkedList in Java.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 11
Wrapper Classes in Java
Define what Wrapper Classes are in Java and explain their usefulness.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 12
Java Exception Handling
Explain Java's exception handling mechanisms, including try , catch , finally blocks, and the distinction between checked and unchecked exceptions.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 13
Difference between let and var in JavaScript
Explain the key differences between let and var keywords in JavaScript.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 14
What is NaN and When it Occurs
Define NaN (Not a Number) in JavaScript and describe common scenarios where it occurs.
From π» Cognizant GenC Next β 2nd Technical Interview Experience (5 Nov 2025) π
- 15
OOPs Pillars Explanation
I was asked to explain all the pillars of Object-Oriented Programming (OOPs).
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 16
Polymorphism Detailed Explanation
The interviewer asked me to explain Polymorphism in detail, particularly in the context of Java.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 17
final, finally, finalize keywords in Java
I was asked to explain the differences between final , finally , and finalize keywords in Java.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 18
Abstract Classes and Interfaces in Java
I was questioned about Abstract Classes and Interfaces in Java, likely about their differences, use cases, or implementation.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 19
Exception Handling with Try-Catch in Java
I was asked about try-catch blocks and general Exception Handling mechanisms in Java.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 20
Time Complexity of Sorting Algorithms
I was asked about the time complexity of various standard sorting algorithms.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 21
SQL Database Normalization
I was asked to explain database Normalization in SQL.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 22
Difference between Left and Left Outer Join
I was asked to explain the difference between a LEFT JOIN and a LEFT OUTER JOIN in SQL.
From π§βπ» Cognizant GenC / GenC Pro/ GenC Next Interview Experience (Nov 2025)
- 23
Exception Handling in Java
Describe the principles and mechanisms of exception handling in Java.
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 24
Checked vs. Unchecked Exceptions
Explain the difference between checked and unchecked exceptions in Java and provide examples.
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
- 25
Null Pointer Exception Handling
What is a Null Pointer Exception (NPE) and what are common strategies to prevent and handle it in Java?
From Cognizant (CTS) Interview Experience β 2025 (IT Branch)
45 more in the Cognizant write-ups.
Cognizant interview questions FAQ
What questions are asked in Cognizant interviews?
Candidates reported 131 distinct questions across 12 Cognizant interviews. 32 coding and DSA questions, 1 system design questions, 28 behavioural and HR questions, 70 other questions.
Which Cognizant interview questions are asked most often?
The most repeated are "Reverse a String" (2 times), "Types of SQL Joins" (2 times), "Method Overloading vs. Overriding" (2 times).
How difficult are Cognizant interview questions?
Of the questions candidates rated, 57% were easy, 36% medium and 7% hard.