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

Programmer Analyst

Cognizant
upvote
share-icon
3 rounds | 8 Coding problems

Interview preparation journey

expand-icon
Journey
Hello !! My name is Harsh Srivastava. I am a 2023 batch BTech graduate in Computer Science from the KIET Group Of Institutions (Ghaziabad). I appeared for Cognizant Technology Solutions in an On-campus drive in our college for the role of Programmer Analyst in July. The rounds conducted in the industry tested me in areas like Problem-Solving, Quantitative Aptitude, Logical Reasoning, English Proficiency, and Communication skills. The most crucial factor that helped me during this drive was maintaining a positive attitude and confidence throughout the selection process, which eventually helped me get shortlisted. I will be sharing all the valuable information regarding rounds, Important topics, and other valuables that might help anyone appearing for this drive in the future.
Application story
The drive was conducted on-campus when Cognizant visited our college. We had to first apply with our resume on the Superset platform using the link shared by our college TPO through email. After applying on Superset, the shortlisted candidates based on our resumes were sent the test link for the first round, which required the installation of the Mettl Browser to take the test. The shortlisted students from the first round were then sent the link for the Communication round, which was mandatory to attend but did not lead to elimination based on scores obtained in it. Candidates who appeared for the communication round then received an interview email with defined interview slot timings and dates. After almost 2-3 weeks of the interview round, the college TPO released the final list of shortlisted candidates.
Why selected/rejected for the role?
I believe I got selected in this drive more because of my positive attitude and self-confidence during rounds, as they helped me a lot in expressing my skills such as problem-solving and communication.
Preparation
Duration: 2 months
Topics: Trees, String Manipulation, OOPS, Logical Reasoning, Stack
Tip
Tip

Tip 1 : Strong fundamentals of Data Structures and Algorithms in any programming language (JAVA preferred).
Tip 2 : Practice Logical Reasoning and Quantitative Aptitude in basic problems.
Tip 3 : Make sure you practice your communication skills before the Interview and also your English Proficiency

Application process
Where: Campus
Eligibility: 60% throughout in Academics
Resume Tip
Resume tip

Tip 1: Make sure your mentioned skills are justified by either projects or any internship experience.

Tip 2: Follow an ATS-friendly format and always add sections like extracurricular and positions of responsibility.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 minutes
Interview date2 Jul 2022
Coding problem3

1. Stack Implementation Using Array

Easy
20m average time
70% success
0/40
Asked in companies
Tata Consultancy Services (TCS)SprinklrCognizant

Stack is a data structure that follows the LIFO (Last in First out) principle. Design and implement a stack to implement the following functions:

1. Push(num): Push the given number in the stack if the stack is not full.

2. Pop: Remove and print the top element from the stack if present, else print -1.

3. Top: Print the top element of the stack if present, else print -1.

4. isEmpty: Print 1 if the stack is empty, else print 0.

5. isFull: Print 1 if the stack is full, else print 0.


You have been given ‘m’ operations which you need to perform in the stack. Your task is to implement all the functions of the stack.


Example:
We perform the following operations on an empty stack which has capacity 2:

When operation 1 1 is performed, we insert 1 in the stack.

When operation 1 2  is performed, we insert 2 in the stack. 

When operation 2 is performed, we remove the top element from the stack and print 2.

When operation 3 is performed, we print the top element of the stack, i.e., 3.

When operation 4 is performed, we print 0 because the stack is not empty.

When operation 5 is performed, we print 0 because the stack is size 1, which is not equal to its capacity.
Problem approach

Declare an array of particular size.
Define a variable “Top” and initialize it as -1.
push(x): insert element in the array by increasing top by one.
pop(): check whether top is not equal to -1 if it is so, return top and decrease its value by one.
size(): return top+1.

Try solving now

2. Find all occurrences of multiple patterns

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

You are given an array 'ARR' of strings having 'N' strings. You are also given a string 'S'. Your task is to find all the occurrences of each string of the array 'ARR' as substrings in the string 'S'.

For example:

Consider the array 'ARR' = { "ab", "aa" } and the string 'S' = "aabab". 
The substring "ab" is present at index 1 and index 3 of the String 'S' and the substring "aa" is present at index 0 of the String S.
Problem approach

Brute force: We will use 2 nested loops, the outer loop will iterate through a text string and the inner loop will iterate through the pattern string. If we find a match, we will print the index and move on to find further patterns, whether they are present in the text or not. We will slide the pattern string over the text string one by one. If we get a match, we will print the index and slide by 1 to check the remaining string.

Worked fine as constraints were small but it can be solved using the Rabin-Karp Algorithm.

Try solving now

3. Kth smallest node in BST

Moderate
15m average time
80% success
0/80
Asked in companies
WalmartMakeMyTripAmazon

You have been given a Binary Search Tree of integers. You are supposed to return the k-th (1-indexed) smallest element in the tree.


For example:
For the given binary search tree and k = 3

Example

The 3rd smallest node is highlighted in yellow colour.   
Problem approach

Here, we first take the input array and insert all elements of the array into a BST.

After that, we take a variable K.

Then, I have to find the Kth largest and smallest element in the BST.

So, I created two functions: one is kthlargest and the other is kthsmallest.

The first function gives us the Kth largest element of that BST, and the second function gives us the Kth smallest element of that BST.

Both functions have two arguments: one is root and another is K. In the kthlargest element function, I call that function in reverse inorder traversal. That means, first right subtree, then the root, and lastly the left subtree. I decrement K by 1 in each function because the maximum value of that BST is the right-most subtree value. Thus, we decrement K by 1 in each function. If at any instance we find K equal to 0, then we simply return the root (which is our desired value). The question is why we reduce K by 1? Because we traverse like reverse inorder traversal, so if we construct an array by traversal, the 0 indexed value will be the rightmost value and the next value will be the next function which terminated after that.

Now, for the kthsmallest element, it's the same as the kthlargest element except for one change: here we follow inorder traversal because we will get the element in sorted order. Therefore, we call the left subtree first, then the root, and then the right subtree. We decrement K by 1 in each function. If at any instance we find K equal to 0, then we return the root. If any function finds that root is equal to NULL, then return NULL.

Try solving now
02
Round
Medium
Video Call
Duration45 minutes
Interview date2 Sep 2022
Coding problem3

The round began with greetings with the interviewer and an ID check, which was an Aadhar Card. Then the interview began with an introduction in which I briefed him on my schooling background, current education field, technical skills, projects I had made, hackathons and technical events I participated in, and extra-curricular activities. I ended the introduction with a description of my hobbies. Then the interviewer asked me some technical questions on data structures, like what an array, stack, etc., is. I answered them all correctly. After that, he shared a link to an online code editor, and then came the coding questions.

1. JavaScript Question

Implement Email verification function in javascript. (Learn)

Problem approach

Just write simple javascript function which return true or false and within it check things such as length of email and it contains @ and . extension or not.

2.

Write a program in JAVA to calculate the Simple Interest of a given Principal, Rate and Time. (Learn)

3. Puzzle

Given the weight of a bag of rice, you want to divide it between two families such that each family gets 50% of the total rice and each member gets 20%. Find the total number of members and rice obtained by them. Assume all rice is distributed.

Problem approach

Tip 1: Total weight is 20kg, so 50% will be 10kg. Each family gets 10kg. 

Tip 2: Each member gets 20% of 10kg, which means 2kg each. Assuming all rice is distributed, 10/2 = 5. 

Tip 3: Each family had five members.

03
Round
Easy
HR Round
Duration45 minutes
Interview date3 Sep 2022
Coding problem2

Basic HR Round

1. Basic HR Questions

The interviewer asked me about my projects and the challenges while working on them. The interviewer asked me about my strengths and weaknesses.

2. Basic HR Question

Why do you want to join Cognizant? 

I am okay with relocating across PAN India.

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
2 rounds | 3 problems
Interviewed by Cognizant
859 views
0 comments
0 upvotes
company logo
Programmer Analyst
3 rounds | 4 problems
Interviewed by Cognizant
842 views
0 comments
0 upvotes
company logo
Programmer Analyst
3 rounds | 4 problems
Interviewed by Cognizant
964 views
0 comments
0 upvotes
company logo
Programmer Analyst
2 rounds | 4 problems
Interviewed by Cognizant
868 views
1 comments
0 upvotes