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

Analyst Trainee

Cognizant
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 1 Month
Topics: Basic of data structures, OOPS theory, classes, python, dbms
Tip
Tip

Tip 1 : don't get afraid
Tip 2 : keep your machine ready, there should not be technical probelem like mic not working
Tip 3 : dress well

Application process
Where: Campus
Eligibility: Above 70 percent marks
Resume Tip
Resume tip

Tip 1 : mention your project
Tip 2 : mention your skills

Interview rounds

01
Round
Medium
Online Coding Interview
Duration180 Minutes
Interview date1 Oct 2021
Coding problem3

Coding question 2 easy,1 hard

1. Ninja And Stops

Hard
45m average time
55% success
0/120
Asked in companies
CognizantFreshworksFlipkart limited

Ninja wants to travel from his house to a given destination, which is ‘X’ miles from his house. Along the way, he needs to fill gas in his vehicle. He knows there are ‘Y’ stations in his way. He also knows the distance between the station and his house, and how many liters of gas that particular station has.

Ninja starts his journey, with an infinite capacity of the tank filled with ‘Z’ liters of starting fuel. Suppose his vehicle uses 1 liter of gas for every mile, and ninja can stop at any gas station, transfer all the available gas at that station and then move ahead.

Now, you need to find out what is the minimum number of stops Ninja must make to reach his desired destination.

Note:
Note that if Ninja reaches a particular stop with no fuel, it can still fill his tank at that stop and continue his journey ahead. Similarly, if he reaches his destination with no fuel, it is still considered to have arrived.
For example :
Given X = 10, Y = 4, ARR[Y] = {[1, 6], [2, 3], [3, 3], [6, 4]} and Z = 1
So the path followed in this case would look like this:

Ninja starts with 1L of gas. 
Drives to the first gas station at position 1, using 1L of gas, then refueling with 6L of gas.
Then, drive to position 6, using 5L of gas, then refueling 4L in the current 1L of gas, making it a total of 5L of gas.
Finally, drive to the destination consuming 4L of gas.
So, Ninja made 2 refueling stops before reaching the destination. So, you need to print 2. 
Try solving now

2. Black Friday

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

It’s black friday and the supermarket near Ninja’s house is offering a special discount to every Nth customer that generates a bill. You are initially given 2 arrays, “PRODUCTS” and “PRICES” where “PRODUCTS[i]” represents the ID of the ith product and “PRICES[i]” represents the price of the ith product per unit. You are also given an integer “DISCOUNT” which represents the discount percentage for every nth customer (i.e. the effective amount to be paid would be ‘(100 - discount) / (100 * amount’).

For each customer that visits the store, you are given 2 arrays, “PRODUCTID” and “QUANTITY” where “PRODUCTID[i]” represents the ID of the ith product and “QUANTITY[i]” represents the quantity of the ith product purchased by the customer.

Your task is to implement the following 2 functions:

1. blackFriday(int N, int discount, int[] products, int[] prices) where every Nth customer receives a discount, “discount” is the discount percentage, “products” contains the product IDs, and “prices” contains the prices of products.

2. generateBill(int[] productID, int[] quantity) where “productID” contains the product IDs and “quantity” contains the quantities of products purchased by the customer.
Try solving now

3. Ninja And His Secret Information

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

Ninja has recently joined the FBI. Ninja got some secret information ‘SECRET_INFORMATION’ which he wants to share with his team. But he can not send this information directly because of the hackers and security threats they pose.

So Ninja decides to encode this ‘SECRET_INFORMATION’ and then send the encoded ‘SECRET_INFORMATION’ to his team members. This way, only his team members can decode this information and thus share it safely.

As Ninja is busy extracting the ‘SECRET_INFORMATION, he asks you for help.

Can you help Ninja and his friends with encoding and decoding the ‘SECRET_INFORMATION’?

Note:

1. The ‘SECRET_INFORMATION’ may contain any possible character out of 256 valid ASCII characters.
2. While decoding the ‘SECRET_INFORMATION’ do not use class members / global/static variables.
3. Do not use any inbuilt library method/function for decoding the ‘SECRET_INFORMATION’.
Try solving now
02
Round
Easy
Face to Face
Duration30 Minutes
Interview date1 Dec 2021
Coding problem1

Asked me how to reverse string,tell me about yourself,visualise data structures in real life,dbms questions easy one

1. Reverse the String

Easy
15m average time
85% success
0/40
Asked in companies
ThalesDeutsche BankPaytm (One97 Communications Limited)

You are given a string 'STR'. The string contains [a-z] [A-Z] [0-9] [special characters]. You have to find the reverse of the string.

For example:

 If the given string is: STR = "abcde". You have to print the string "edcba".
follow up:
Try to solve the problem in 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

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

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 5 problems
Interviewed by Cognizant
1746 views
1 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Cognizant
1063 views
0 comments
0 upvotes
company logo
Program Analyst
2 rounds | 6 problems
Interviewed by Cognizant
604 views
0 comments
0 upvotes
company logo
Programmer Analyst Trainee
3 rounds | 8 problems
Interviewed by Cognizant
773 views
0 comments
0 upvotes