i
Cognizant
Filter interviews by
JDK, JVM, and JRE are core components of Java, each serving distinct roles in the development and execution of Java applications.
JDK (Java Development Kit): A complete toolkit for Java development, including the compiler (javac), libraries, and tools for building Java applications.
JRE (Java Runtime Environment): Provides the libraries and components necessary to run Java applications, but does not include developm...
Functional interfaces are interfaces with a single abstract method, enabling lambda expressions in Java.
A functional interface can have multiple default or static methods but only one abstract method.
Common examples include Runnable, Callable, and Comparator.
They are used primarily in lambda expressions and method references.
You can define your own functional interfaces using the @FunctionalInterface annotation.
In Java, '==' checks reference equality, while '.equals()' checks value equality for objects.
== compares memory addresses for reference types.
Example: String a = new String("test"); String b = new String("test"); a == b returns false.
.equals() compares the actual content of objects.
Example: a.equals(b) returns true.
For primitive types, == compares actual values.
Example: int x = 5; int y = 5; x == y returns true.
Java is a versatile, object-oriented programming language known for its portability, security, and robust performance.
Object-Oriented: Java supports encapsulation, inheritance, and polymorphism, allowing for modular and reusable code. Example: Class and object creation.
Platform Independence: Java code is compiled into bytecode, which can run on any device with a Java Virtual Machine (JVM). Example: Write once, run...
What people are saying about Cognizant
A palindrome is a word, phrase, or sequence that reads the same backward as forward, like 'madam' or 'racecar'.
Definition: A palindrome is a string that remains unchanged when reversed. Example: 'level', 'radar'.
Ignoring Spaces and Punctuation: When checking for palindromes, spaces and punctuation are often ignored. Example: 'A man, a plan, a canal, Panama!'
Case Sensitivity: Palindrome checks can be case insensiti...
A program to check if a given number is prime or not.
Create a function to check if a number is prime by iterating from 2 to the square root of the number.
If the number is divisible by any number other than 1 and itself, it is not prime.
Handle edge cases like 0, 1, and negative numbers separately.
Inheritance is a fundamental OOP concept allowing a class to inherit properties and methods from another class.
Promotes code reusability by allowing new classes to use existing class features.
Supports method overriding, enabling a subclass to provide a specific implementation of a method.
Facilitates a hierarchical classification of classes, making it easier to manage and understand code.
Example: If 'Animal' is a s...
Print each letter in a string along with the number of times it occurs
Iterate through the string and count the occurrences of each letter
Use a HashMap to store the letter as key and count as value
Print the letter and count for each unique letter
Data can be retrieved from a database in Spring Boot using JPA repositories or JDBC templates.
Use JPA repositories to create custom queries and retrieve data from the database.
Use JDBC templates to execute SQL queries and retrieve data from the database.
Configure the data source in the application.properties file.
Use annotations like @Repository, @Entity, @Table, etc. to map Java objects to database tables.
Static method is a method that belongs to the class itself, not to any specific instance of the class.
Static methods can be called without creating an instance of the class.
They are commonly used for utility methods that do not require access to instance variables.
Static methods are declared using the 'static' keyword.
Example: Math.max() is a static method in the Math class that returns the maximum of two numbers.
This interview question covers various topics including programming, design patterns, data structures, and exception handling in Java.
Write a program to generate the Fibonacci series
Write a program using boolean variables
Explain the ClassCastException and how to handle it
Discuss the Singleton design pattern and its implementation with different JDK versions
Explain abstract classes and interfaces in your current project
...
I appeared for an interview in Nov 2024.
I appeared for an interview in Mar 2025, where I was asked the following questions.
I appeared for an interview in Feb 2025, where I was asked the following questions.
A palindrome is a word, phrase, or sequence that reads the same backward as forward, like 'madam' or 'racecar'.
Definition: A palindrome is a string that remains unchanged when reversed. Example: 'level', 'radar'.
Ignoring Spaces and Punctuation: When checking for palindromes, spaces and punctuation are often ignored. Example: 'A man, a plan, a canal, Panama!'
Case Sensitivity: Palindrome checks can be case insensitive. E...
The Fibonacci sequence is a series of numbers where each number is the sum of the two preceding ones, starting from 0 and 1.
Definition: The Fibonacci sequence starts with 0 and 1, and each subsequent number is the sum of the previous two (e.g., 0, 1, 1, 2, 3, 5, 8, ...).
Recursive Approach: A simple way to calculate Fibonacci numbers is using recursion, but it can be inefficient for large indices due to repeated calcula...
I appeared for an interview in Mar 2025, where I was asked the following questions.
I appeared for an interview in Jan 2025, where I was asked the following questions.
I appeared for an interview in Nov 2024, where I was asked the following questions.
Code optimization improves performance, reduces resource usage, and enhances maintainability in Java applications.
Use efficient algorithms: Choose algorithms with lower time complexity, e.g., use quicksort instead of bubble sort for large datasets.
Minimize object creation: Reuse objects when possible to reduce garbage collection overhead, e.g., use StringBuilder instead of concatenating strings.
Optimize loops: Avoid un...
I applied via Naukri.com and was interviewed in Dec 2023.ย There were 3 interview rounds.
1 round in fresher Java coding test
Second Java aptitude test
I applied via Naukri.com and was interviewed in Sep 2023.ย There were 2 interview rounds.
Idempotency is the property of an operation where multiple identical requests have the same effect as a single request.
Idempotency ensures that even if the same request is made multiple times, the result will be the same.
In RESTful APIs, using HTTP methods like GET and PUT can help achieve idempotency.
Design patterns like Command Pattern and State Pattern can be used to ensure idempotency in projects.
Some of the top questions asked at the Cognizant Java Developer interview -
The duration of Cognizant Java Developer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 32 interview experiences
Difficulty level
Duration
based on 163 reviews
Rating in categories
Hyderabad / Secunderabad,
Chennai
+16-11 Yrs
Not Disclosed
Associate
71.2k
salaries
| โน5.3 L/yr - โน13.6 L/yr |
Programmer Analyst
56.1k
salaries
| โน3.5 L/yr - โน8 L/yr |
Senior Associate
55.9k
salaries
| โน9.8 L/yr - โน23.7 L/yr |
Senior Processing Executive
30.1k
salaries
| โน2.5 L/yr - โน6.5 L/yr |
Technical Lead
18.6k
salaries
| โน6 L/yr - โน21.2 L/yr |
TCS
Infosys
Wipro
Accenture