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

Programmer Analyst Trainee

Cognizant
upvote
share-icon
2 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
This was my one of the best interviews that I have experienced. It was very good and lasted for around 60 minutes. It was mixture of the aptitude cloud concepts networking and all.
Application story
Before applying in cts I was rejected in two interviews. I was feeling very low. Then I worked hard in my basics and the database concepts along with the aptitude.
Why selected/rejected for the role?
I was selected due the quick response that I have given to the aptitude questions to the interviewer. I was asked the cloud concepts also and I answered those correctly.
Preparation
Duration: 3 months
Topics: Cloud concepts, computer networking, oops concepts, data structure and algorithm, aptitude, programming languages
Tip
Tip

Tip 1 : Prepare well for aptitude
Tip 2 : Prepare well with the final year project
Tip 3 :Prepare well for the new technologies

Application process
Where: Campus
Eligibility: Above 60 percent overall and no standing arrears
Resume Tip
Resume tip

Tip 1:Don't add too many things
Tip 2: At least two projects should be there to create impact

Interview rounds

01
Round
Medium
Online Coding Interview
Duration90 mins
Interview date17 Sep 2020
Coding problem3

We were given one day time within that time we have to select the time slot of 90 minutes on which we want to give the exam. I selected the morning time and had given the exam.

1. Find error

There was a code given and i need found out the errors in the code and correct that code and submit it. Note: similar like this there were 5 to 6 questions

 #include int main(){  

  int num, LD;  

  printf(" Enter a number"4589);  

  scanf("%d", &num); 

   LD = num / 10;

     printf(" \n The Last Digit of a Given Number %d =  %d", num, LD);  

  return 0;}

Problem approach

Step 1: I gone through the code and tried to understand what is the requirement.
Step 2: I gone through the code and found the error.
Solution 1:
#include 
int main()
{
int num, LD;
printf(" Enter a number");
scanf("%d", &num);
LD = num % 10; // instead of '/' we have to give '%' 
printf(" \n The Last Digit of a Given Number %d = %d", num, LD);
return 0;
}
Solution 2:
void palindrome(int number)
{
int rev = 0,store, n1,left;
n1=number;
store= number;
while (number > 0)
{
left= number%10; //these are the correct lines
rev = rev * 10 + left; //these are the correct lines
number=number/10; //these are the correct lines
}
if(n1==rev)
printf("Number %d is Palindrome number",n1);
else
printf("it is not a Palindrome number");
}
Solution 3:
int sumOfValue(int len, int* arr, int value)
{
int sum = 0;
for(int i =0 ; i < len; i++ )
{
if(arr[i]%value == 0) 
sum += arr[i]; //these are the correct lines

}
return sum;
}

2. Find Error

Example 2 :
void palindrome(int number)
{
int rev = 0,store, n1,left;
n1=number;
store= number;
while (number > 0)
{
left= number/10;
rev = rev + 10 * left;
number=number%10;
}
if(n1==rev)
printf("Number %d is Palindrome number",n1);
else
printf("it is not a Palindrome number");
}

3. Find Error

Example 3:
int sumOfValue(int len, int* arr, int value)
{
int sum = 0;
for(int i =0 ; i < len; i++ )
{
if(arr[i]%value == 0) 
sum =+ arr[i];
}
return sum;
}

02
Round
Medium
Video Call
Duration90 mins
Interview date19 Oct 2020
Coding problem3

It was a long interview. First it was started with the technical concepts of my project. Then I was asked some questions from my resume like my hobby was cricket so I was asked some questions about cricket. Then after that I was asked from the subjects that I have mentioned in my resume. I mentioned cloud concepts so I was asked about saas, paas, iaas. I was asked about data structure like stack queue linked list etc. I was asked about the ACID properties from dbms. I was asked about functions and different types of pointers.
After that I was asked to take a pen and paper and I was given on spot aptitudes and he asked me to solve those.
There were around 10 questions one by one the interviewer shared and I solved 9 of them. That was the point the interviewer got impressed.
At last interviewer asked me to share the screen and write logic of some codes.

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

I practised it before the interview so I was confident. I wrote the whole code in c.
Solution 1:
#include 
int main() 

int n,r,sum=0,temp; 
printf("enter the number="); 
scanf("%d",&n); 
temp=n; 
while(n>0) 

r=n%10; 
sum=sum+(r*r*r); 
n=n/10; 

if(temp==sum) 
printf("armstrong number "); 
else 
printf("not armstrong number"); 
return 0; 
}

Try solving now

2. Check If The String Is A Palindrome

Easy
10m average time
90% success
0/40
Asked in companies
SamsungSterlite Technologies LimitedGrab

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.
Problem approach

Solution

#include 
int main() 

int n,r,sum=0,temp; 
printf("enter the number="); 
scanf("%d",&n); 
temp=n; 
while(n>0) 

r=n%10; 
sum=(sum*10)+r; 
n=n/10; 

if(temp==sum) 
printf("palindrome number "); 
else 
printf("not palindrome"); 
return 0; 
}

Try solving now

3. N-th Fibonacci Number

Moderate
40m average time
70% success
0/80
Asked in companies
HCL TechnologiesCiscoNatwest Group

You are given an integer ‘N’, your task is to find and return the N’th Fibonacci number using matrix exponentiation.

Since the answer can be very large, return the answer modulo 10^9 +7.

Fibonacci number is calculated using the following formula:
F(n) = F(n-1) + F(n-2), 
Where, F(1) = F(2) = 1.
For Example:
For ‘N’ = 5, the output will be 5.
Problem approach

Solution

#include 
int main() 

int n1=0,n2=1,n3,i,number; 
printf("Enter the number of elements:"); 
scanf("%d",&number); 
printf("\n%d %d",n1,n2);
for(i=2;i { 
n3=n1+n2; 
printf(" %d",n3); 
n1=n2; 
n2=n3; 

return 0;

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
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
1408 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