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

Java Developer

Cognizant
upvote
share-icon
3 rounds | 9 Coding problems

Interview preparation journey

expand-icon
Journey
This process take minimum 1-2 months for selection the candidates . Firstly Clear your basics and most important you have to create well neat resume and having the basics fundamental , having positive attitude before interview process . So Believe in yourself and believe me you learnt so much through this journey.
Application story
This is a on campus opportunity we have to applied on superset for Genc Next Job profile . Then after some week we got a list through our TPO then we were start the process and it take 1-2 months for slection .
Why selected/rejected for the role?
Firstly I would say they are looking good DSA level for this Job profile and I am one of them. And projects also play major role so do atleast two project by yourself because they ask the deep question through your Projects And one more thing Be confident if you didn't know the answer simply leave it and try second one .
Preparation
Duration: 3 Months
Topics: Java , Data Structure & Algorithm, MySQL , DBMS , OPPS , Aptitude Questions
Tip
Tip

Tip 1 : Practice DSA & Mysql and previous year Questions as many you can
Tip 2 : Clear Basic Fundamentals of your core Subject i.e . DBMS , OOPS ,etc
Tip 3 : Having Positive Mindset and atleast do 2 projects .

Application process
Where: Campus
Eligibility: 6 CGPA
Resume Tip
Resume tip

Tip 1 : Write those Technical skills in your Resume which you know otherwise no use of them.
Tip 2 : Mention Two Projects and Some Certification & some coding profile link give good impact.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration180 Minutes
Interview date15 Jul 2021
Coding problem4

This round start at 4:00 Pm to 8:00 Pm . Environment was good .

1. Find prime numbers

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

You are given a positive integer ‘N’. Your task is to print all prime numbers less than or equal to N.

Note: A prime number is a natural number that is divisible only by 1 and itself. Example - 2, 3, 17, etc.

You can assume that the value of N will always be greater than 1. So, the answer will always exist.

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.
Try solving now

3. SQL Question

Mysql Query to get the maximum salary of each department form the tables employee.

Problem approach

Tip 1 : Use Max aggrigate function
Tip 2 : Use GroupBy clause on department

4. SQL Question

Mysql Query :Print the details of employee whose department is IT.

Problem approach

Tip 1 : Use Join on Department and Employee
Tip 2 : Inner join check primary key and foreign key column for matching the records 
Tip 3 : use where clause

02
Round
Medium
Face to Face
Duration80 Minutes
Interview date19 Aug 2021
Coding problem4

This Round is Technical Round on Superset Platform . And Interviewer was 10+ year of exp and ask some deep question.

1. Permutations of a String

Moderate
15m average time
85% success
0/80
Asked in companies
MakeMyTripDisney + HotstarTata Consultancy Services (TCS)

You are given a string 'STR' consisting of lowercase English letters. Your task is to return all permutations of the given string in lexicographically increasing order.

String A is lexicographically less than string B, if either A is a prefix of B (and A ≠ B), or there exists such i (1 <= i <= min(|A|, |B|)), that A[i] < B[i], and for any j (1 <= j < i) A[i] = B[i]. Here |A| denotes the length of the string A.

For example :

If the string is “bca”, then its permutations in lexicographically increasing order are { “abc”, “acb”, “bac”, “bca”, “cab”, “cba” }.
Note:
Given string contains unique characters.
Problem approach

Write a recursive function that print distinct permutations. Make a boolean array of size N which accounts the character being used. If the character has not been used then the recursive call will take place. Otherwise, don’t make any call. Terminating condition will be when the passed string is empty.

Try solving now

2. Anagram Pairs

Moderate
30m average time
60% success
0/80
Asked in companies
JP MorganNearbuyTata Consultancy Services (TCS)

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct. 
Problem approach

Step:1 Two strings are said to be anagram if we can form one string by arranging the characters of another string. For example, ABC and BCA. Here, we can form ABC by arranging the characters of BCA.

Step:2 We first convert the strings to lowercase. It is because Java is case sensitive and S1 and s1 are two 
difference String in Java.

Step:3 check if length is same. (str1 & str2)
str1.toCharArray() - converts the string into a char array (str2 also)
Arrays.sort() - sorts both the char arrays
Arrays.equal() - checks if the sorted char array are equal

Step: 4 if sorted arrays are equal, then the strings are anagram.

Try solving now

3. Technical Question

Design Singleton Pattern class .

Problem approach

Tip 1 : Create Private Constructor: No other class can make instance
Tip 2 : Create public method getInstance with Synchronized block for calling the instance
Tip 3 : Create Private instance

4. Technical Questions

Ask Basic salary quey from mysql and also ask about joins , Opps Concept , Java8 features , MultiThreading , Singleton Class , Etc

Problem approach

Tip 1 : Clear Basic Fundamentals and give real time Example about OPPS Concept.
Tip 2 : Write Mysql query using subquery & also using joins And do project revision .

03
Round
Easy
HR Round
Duration20 Minutes
Interview date6 Sep 2022
Coding problem1

This is HR Round on superset Platform when you clear both assignment round as well as technical round . Its almost a formality Round you can say that.

1. Basic HR Questions

HR Start with the Introduction then she ask me the feedback form the technical round and then ask about my family background and some opps concpet also . Then she ask me about my projects , relocation consent , check my marksheet , why cognizant? at last she ask me about one puzzle related to water buckets.

Problem approach

Tip 1 : Be Confident and Show positive attitude.
Tip 2 : Go through your Projects and some puzzles.

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 - 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
company logo
Java Developer
2 rounds | 9 problems
Interviewed by Cognizant
5141 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Java Developer
3 rounds | 20 problems
Interviewed by Ernst & Young (EY)
9007 views
2 comments
0 upvotes
company logo
Java Developer
2 rounds | 3 problems
Interviewed by Tata Consultancy Services (TCS)
11960 views
0 comments
0 upvotes
company logo
Java Developer
2 rounds | 2 problems
Interviewed by HCL Technologies
7092 views
0 comments
0 upvotes