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

Programmer Analyst Trainee

Cognizant
upvote
share-icon
4 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Journey
I have completed my B.Tech in Computer Science and Engineering. In my final year, Cognizant visited our campus for recruitment, and I was selected for the Programmer Analyst Trainee role. Before Cognizant, I attended many interviews but was unable to crack any. However, those interviews provided me with valuable experience. I learned how to handle questions and identified the skills I needed to improve. Ultimately, this experience helped me succeed in cracking Cognizant’s selection process.
Application story
Cognizant visited our campus for recruitment, and we were asked to register for it on Superset. After that, there was a communication round, followed by a technical assessment. Clearing the technical assessment made us eligible for the interview.
Why selected/rejected for the role?
I was selected because I believe I was confident during the interview. If I encountered a question I didn’t know, I still expressed myself in a way that didn’t make me appear less confident.
Preparation
Duration: 4 months
Topics: SQL, DSA, ReactJS, Python, JavaScript, OOPs
Tip
Tip

Tip 1: Practice at least 250 questions.
Tip 2: Do at least 2 projects.
Tip 3: Focus on both DSA and development.

Application process
Where: Campus
Eligibility: Above 60% (Salary Package: 4 LPA)
Resume Tip
Resume tip

Tip 1: Add a good project.
Tip 2: Write only the things you are confident about.

Interview rounds

01
Round
Medium
Online Coding Test
Duration60 minutes
Interview date6 Jun 2024
Coding problem2
Easy
0/40
Asked in companies
Hexaware TechnologiesSamsung R&D InstituteCognizant

Given an array of length N, you need to find and print the sum of all elements of the array.

Problem approach

The idea is to use a recursive approach to calculate the sum of an array by breaking it down into two cases:

Base case – If the array is empty, the sum is 0.

Recursive case – The sum is calculated by adding the first element to the sum of the remaining elements, which is computed through a recursive call with the array shifted by one position and the size reduced by one.

Try solving now

2. Maximum Frequency Number

Easy
10m average time
90% success
0/40
Asked in companies
CognizantQualcommWalmart

Ninja is given an array of integers that contain numbers in random order. He needs to write a program to find and return the number which occurs the maximum times in the given input. He needs your help to solve this problem.

If two or more elements contend for the maximum frequency, return the element which occurs in the array first i.e. whose index is lowest.

For example,

For 'arr' = [ 1, 2, 3, 1, 2]. you need to return 1.
Problem approach

Using a hash table, this approach stores each element’s frequency and then finds the element with the maximum frequency. This method is efficient in terms of both time and space.

Try solving now
02
Round
Medium
Online Coding Test
Duration60 minutes
Interview date8 Jun 2024
Coding problem1

1. Maximum Subarray Sum

Moderate
25m average time
75% success
0/80
Asked in companies
UberTata Consultancy Services (TCS)Dunzo

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.


For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86.


Given the array [-5, -1, -8, -9], the maximum sum would be -1.


Follow up: Do this in O(N) time.

Problem approach

The idea is to use Kadane’s algorithm, which traverses the array from left to right and, for each element, finds the maximum sum among all subarrays ending at that element. The result is the maximum of all these values.

To calculate the maximum sum of a subarray ending at the current element (let’s call it maxEnding), we use the maximum sum ending at the previous element. For any element, we have two choices:

Extend the maximum sum subarray ending at the previous element by adding the current element to it. If the maximum subarray sum ending at the previous index is positive, it is always better to extend the subarray.

Start a new subarray from the current element if the maximum subarray sum ending at the previous index is negative. In this case, starting a new subarray from the current element is a better choice.

This means that maxEnding at index i is calculated as:

maxEnding[i]=max(maxEnding[i−1]+arr[i],arr[i])

The maximum value of maxEnding at any index will be our final answer.

Try solving now
03
Round
Medium
Face to Face
Duration60 minutes
Interview date14 Jun 2024
Coding problem1

1. Armstrong Number

Easy
15m average time
85% success
0/40
Asked in companies
OracleIBMOptum

You are given an integer ‘NUM’ . Your task is to find out whether this number is an Armstrong number or not.

A k-digit number ‘NUM’ is an Armstrong number if and only if the k-th power of each digit sums to ‘NUM’.

Example
153 = 1^3 + 5^3 + 3^3.

Therefore 153 is an Armstrong number.
Problem approach

Create a recursive function armstrongSum(). In this function:

Calculate the value of the last digit raised to the power of the total number of digits, K.

Add it to the sum of the remaining digits raised to the power of K by making a recursive call. This call processes the next digit by removing the current last digit from the number.

Continue this process until N becomes 0, indicating that all digits have been processed. At this point, the function returns 0.

Finally, compare the sum returned by the armstrongSum() function with the original number.

If the sum equals the original number, return true.

Otherwise, return false.

Try solving now
04
Round
Easy
HR Round
Duration60 minutes
Interview date14 Jun 2024
Coding problem1

Basic HR questions were asked.

1. HR Questions

  • What motivates you to join Cognizant?
  • Introduce yourself.

Here's your problem of the day

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

Skill covered: Programming

To make an AI less repetitive in a long paragraph, you should increase:

Choose another skill to practice
Similar interview experiences
company logo
Programmer Analyst Trainee
4 rounds | 6 problems
Interviewed by Cognizant
1173 views
0 comments
0 upvotes
company logo
Programmer Analyst Trainee
2 rounds | 3 problems
Interviewed by Cognizant
1409 views
0 comments
0 upvotes
company logo
Programmer Analyst Trainee
3 rounds | 7 problems
Interviewed by Cognizant
925 views
0 comments
0 upvotes
company logo
Programmer Analyst Trainee
3 rounds | 8 problems
Interviewed by Cognizant
773 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Programmer Analyst Trainee
3 rounds | 4 problems
Interviewed by Newgen Software
811 views
0 comments
0 upvotes