Cognizant Pvt. Ltd. interview experience Real time questions & tips from candidates to crack your interview

Programmer Analyst Trainee

Cognizant Pvt. Ltd.
upvote
share-icon
2 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Application story
I got this opportunity through my campus placement drive. After learning about the role and selection process, I focused on strengthening my fundamentals in DSA and core subjects. I practiced coding problems consistently and prepared for both technical and interview rounds. With proper preparation and confidence, I was able to successfully clear the process and secure the offer.
Preparation
Duration: 2 months
Topics: OOPs, DSA, JavaScript, React, Node, Java, HTML, CSS, SQL, Aptitude, English, OS, Computer Networks
Tip
Tip

Tip 1: Focus on strong fundamentals.
Have clear basics in Java, SQL, OOP, and DSA before joining. Strong fundamentals help you adapt quickly to different projects and technologies.

Tip 2: Be proactive and communicate well.
Take the initiative to learn beyond assigned tasks and don’t hesitate to ask questions. Good communication and ownership make a big difference early in your career.

Application process
Where: Campus
Eligibility: Above 7 CGPA, (Salary Package: 4 LPA)
Resume Tip
Resume tip

Tip 1: Don’t just list technologies; instead, show proof.
Instead of writing “Java, SQL, React,” mention what you built using them and the problem it solved. Recruiters care about application, not a list of skills.

Tip 2: Remove weak or basic projects.
If you have 4–5 projects, keep only the strongest 2–3 that show depth. One solid, well-explained project is far better than five tutorial clones.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration180 minutes
Interview date15 Jan 2025
Coding problem3

1. First non repeating character

Easy
15m average time
80% success
0/40
Asked in companies
QuikrHCL TechnologiesMakeMyTrip

Ninja is now bored with numbers and is now playing with characters but hates when he gets repeated characters. Ninja is provided a string, and he wants to return the first unique character in the string.The string will contain characters only from the English alphabet set, i.e., ('A' - 'Z') and ('a' - 'z'). If there is no non-repeating character, print the first character of the string. If there is no non-repeating character, return the first character of the string.

Try solving now

2. Pair Sum

Easy
15m average time
90% success
0/40
Asked in companies
Media.netExpedia GroupQuikr

You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to return the list of all pairs of elements such that each sum of elements of each pair equals 'S'.

Note:

Each pair should be sorted i.e the first value should be less than or equals to the second value. 

Return the list of pairs sorted in non-decreasing order of their first value. In case if two pairs have the same first value, the pair with a smaller second value should come first.
Try solving now

3. Web Debugging

You are given a simple webpage containing:

  • A heading
  • A button labeled "Change Theme"
  • Basic styling applied through CSS

The webpage has the following issues:

  • In the HTML file, one tag is incorrectly written, causing the button not to render properly.
  • In the CSS file, there is a mistake in a property name, which prevents the background color from being applied.
  • In the JavaScript file, you need to implement functionality so that clicking the button changes the background color of the webpage.
02
Round
Hard
Face to Face
Duration80 minutes
Interview date15 Feb 2025
Coding problem6

1. Check If The String Is A Palindrome

Easy
10m average time
90% success
0/40
Asked in companies
IntuitSprinklrCIS - Cyber Infrastructure

You are given a string 'S'. Your task is to check whether the string is palindrome or not. For checking palindrome, consider alphabets and numbers only and ignore the symbols and whitespaces.

Note :

String 'S' is NOT case sensitive.

Example :

Let S = “c1 O$d@eeD o1c”.
If we ignore the special characters, whitespaces and convert all uppercase letters to lowercase, we get S = “c1odeedo1c”, which is a palindrome. Hence, the given string is also a palindrome.
Try solving now

2. Second largest element in the array

Easy
15m average time
80% success
0/40
Asked in companies
AdobeSamsungIBM

You have been given an array/list 'ARR' of integers. Your task is to find the second largest element present in the 'ARR'.

Note:
a) Duplicate elements may be present.

b) If no such element is present return -1.
Example:
Input: Given a sequence of five numbers 2, 4, 5, 6, 8.

Output:  6

Explanation:
In the given sequence of numbers, number 8 is the largest element, followed by number 6 which is the second-largest element. Hence we return number 6 which is the second-largest element in the sequence.
Try solving now

3. Count Frequency in a range

Easy
0/40

You are given an array 'arr' of length 'n' containing integers within the range '1' to 'x'.


Your task is to count the frequency of all elements from 1 to n.

Note:
You do not need to print anything. Return a frequency array as an array in the function such that index 0 represents the frequency of 1, index 1 represents the frequency of 2, and so on.
Example:
Input: ‘n’ = 6 ‘x’ = 9 ‘arr’ = [1, 3, 1, 9, 2, 7]    
Output: [2, 1, 1, 0, 0, 0]
Explanation: Below Table shows the number and their counts, respectively, in the array
Number         Count 
 1                2
 2              1
 3                1
 4                0
 5                0
 6                0
Try solving now

4. Similar String Groups

Moderate
35m average time
65% success
0/80
Asked in companies
ApplePayPal

Two strings ‘S1’ and ‘S2’ are considered similar if either ‘S1’ equals ‘S2’ or we can swap two letters of ‘S1’ (at different positions) so that it equals ‘S2’.

For Example :

“code” and “eodc” are similar because we can swap letters at positions 0 and 3 in ‘code’ to get “eodc”.

A group of strings is called the Similar String Group, if either it has only one string or each string is similar to at least one other string in the group.

For Example :

Group of strings  [“code”, “eodc”, “edoc”]  is a Similar String Group, because “code” is similar to “eodc”, “eodc” is similar to both “code” and “edoc” and “edoc” is similar to “eodc” i.e each string is similar to at least one other string of group.

You are given an array/list ‘STRS’ consisting of ‘N’ strings. Every string in ‘STRS’ is an anagram of every other string in ‘STRS’. Your task is to find and return the number of similar string groups in ‘STRS’.

Note :
1. Two strings are an anagram of each other if they have the same characters but these characters can be arranged in a different order. For example, “LISTEN” and “SILENT” are anagrams.
For Example :
Consider ‘STRS’ = [“code”, “doce”, ”code”, “ceod”, “eodc”, “edoc”, “odce”].    

There are 2 Similar String Groups in ‘STRS’ -:
1. “code”, “code”, “doce“, “odce”, eodc”, “edoc”
2. “ceod”

Thus, we should return 2 in this case.
Try solving now

5. Missing Number

Moderate
30m average time
70% success
0/80
Asked in companies
SamsungFacebookApple

You are given an array/list ‘BINARYNUMS’ that consists of ‘N’ distinct strings which represent all integers from 0 to N in binary representation except one integer. This integer between 0 to ‘N’ whose binary representation is not present in list ‘BINARYNUMS’ is called ‘Missing Integer’.

Your task is to find the binary representation of that ‘Missing Integer’. You should return a string that represents this ‘Missing Integer’ in binary without leading zeros.

Note

1. There will be no leading zeros in any string in the list ‘BINARYNUMS’.

Example:

Consider N = 5 and the list ‘binaryNums’=  [“0”, “01”, “010”, “100”, “101”].  This list consists of the binary representation of numbers [0, 1, 2, 4, 5]. Clearly, the missing number is 3 and its binary representation will be “11”. So you should return string “11”.
Try solving now

6. Reverse Linked List

Moderate
15m average time
85% success
0/80
Asked in companies
WalmartHCL TechnologiesInfo Edge India (Naukri.com)

Given a singly linked list of integers. Your task is to return the head of the reversed linked list.

For example:
The given linked list is 1 -> 2 -> 3 -> 4-> NULL. Then the reverse linked list is 4 -> 3 -> 2 -> 1 -> NULL and the head of the reversed linked list will be 4.
Follow Up :
Can you solve this problem in O(N) time and O(1) space complexity?
Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by OYO
4898 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
1043 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 5 problems
Interviewed by Meesho
6638 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 9 problems
Interviewed by Salesforce
3639 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Programmer Analyst Trainee
3 rounds | 4 problems
Interviewed by Newgen Software
837 views
0 comments
0 upvotes