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...
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...
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.
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.
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...
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.
Lambda expressions in Java provide a concise way to represent functional interfaces using an expression.
Lambda expressions consist of parameters, an arrow token (->), and a body. Example: (x, y) -> x + y
They enable functional programming in Java, allowing for cleaner and more readable code.
Commonly used with Java's Collection Framework, especially in methods like forEach, map, and filter.
They can capture var...
I appeared for an interview in Nov 2024.
To find the 3rd highest salary employee, we can use a SQL query with the 'LIMIT' and 'OFFSET' keywords.
Use a SQL query to select distinct salaries in descending order
Use 'LIMIT 1 OFFSET 2' to get the 3rd highest salary
Join this result with the employee table to get the employee details
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 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
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 superc...
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.
Lambda expressions in Java provide a concise way to represent functional interfaces using an expression.
Lambda expressions consist of parameters, an arrow token (->), and a body. Example: (x, y) -> x + y
They enable functional programming in Java, allowing for cleaner and more readable code.
Commonly used with Java's Collection Framework, especially in methods like forEach, map, and filter.
They can capture variable...
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.
I applied via Campus Placement
Plain apti test, easy, LRDI, Quant, VARC
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 30 interview experiences
Difficulty level
Duration
based on 158 reviews
Rating in categories
Associate
73.2k
salaries
| ₹5.1 L/yr - ₹14.4 L/yr |
Programmer Analyst
56.1k
salaries
| ₹2 L/yr - ₹9.2 L/yr |
Senior Associate
52.5k
salaries
| ₹9 L/yr - ₹28.5 L/yr |
Senior Processing Executive
29.6k
salaries
| ₹1.9 L/yr - ₹9 L/yr |
Technical Lead
18k
salaries
| ₹6 L/yr - ₹25.5 L/yr |
TCS
Infosys
Wipro
Accenture