i
MindGate Solutions
Filter interviews by
Java MCQ questions and code snippet
Oops concept in Java program refers to Object-Oriented Programming principles like inheritance, encapsulation, polymorphism, and abstraction.
Inheritance allows a class to inherit properties and behavior from another class.
Encapsulation hides the internal state of an object and only exposes necessary methods to interact with it.
Polymorphism allows objects of different classes to be treated as objects of a common supercl...
I applied via Naukri.com and was interviewed in Oct 2021. There were 4 interview rounds.
I applied via Naukri.com and was interviewed before Aug 2020. There was 1 interview round.
The 4 pillars of OOP are Abstraction, Encapsulation, Inheritance, and Polymorphism.
Abstraction: Hiding implementation details and showing only necessary information. Example: A car dashboard only shows necessary information like speed, fuel level, etc.
Encapsulation: Binding data and methods that manipulate the data together. Example: A bank account class with methods to deposit, withdraw, and check balance.
Inheritance:...
Arrays are fixed in size and can store elements of the same type, while collections are dynamic and can store elements of different types.
Arrays have a fixed length, while collections can grow or shrink dynamically.
Arrays can only store elements of the same type, while collections can store elements of different types.
Arrays use indexed access for retrieval and modification, while collections provide various methods fo...
Collection is a group of objects while Map is a key-value pair data structure.
Collection is used to store and manipulate a group of objects.
Map is used to store and retrieve data based on key-value pairs.
Collection classes include List, Set, and Queue.
Map classes include HashMap, TreeMap, and LinkedHashMap.
Collections allow duplicate elements while Maps do not.
Example: Collection - List of names, Map - Student ID and c
JDBC steps to connect to a database
Load the JDBC driver class
Establish a connection to the database using the DriverManager class
Create a statement object to execute SQL queries
Execute the SQL queries and retrieve the results
Close the statement and connection objects
Multi threading is the concurrent execution of multiple threads in a single program.
Allows multiple tasks to run concurrently
Improves performance and responsiveness
Enables efficient utilization of CPU resources
Can be used for parallel processing
Examples: running multiple calculations simultaneously, handling multiple client requests
The life cycle of a thread refers to its various states and transitions during its execution.
A thread starts in the new state when it is created.
It moves to the runnable state when it is ready to run but waiting for the CPU.
When the CPU starts executing the thread, it enters the running state.
A thread can temporarily move to the blocked or waiting state when it is waiting for a resource or signal.
A thread can be termin...
String is immutable because its value cannot be changed once it is created.
String objects are stored in the String pool, which is a part of the heap memory.
When a string is modified, a new string object is created with the modified value.
Immutable strings are thread-safe and can be safely shared among multiple threads.
String immutability allows for efficient memory utilization and optimization.
Top trending discussions
I applied via Approached by Company and was interviewed in Sep 2024. There were 3 interview rounds.
I am a Java Developer with 5 years of experience in developing web applications using Java, Spring, and Hibernate.
5 years of experience in Java development
Proficient in Spring and Hibernate frameworks
Strong understanding of web application development
Developed a web-based inventory management system using Java, Spring, and Hibernate
Designed and implemented database schema using Hibernate
Developed RESTful APIs using Spring framework
Worked on front-end development using HTML, CSS, and JavaScript
Collaborated with team members to troubleshoot and resolve issues
Participated in code reviews and testing
Interfaces and Abstract classes in Java are used for achieving abstraction and defining contracts for classes to implement.
Interfaces in Java are like blueprints for classes, defining methods that must be implemented by classes that implement the interface.
Abstract classes are classes that cannot be instantiated and can have both abstract and concrete methods.
Example of an interface in Java: public interface Shape { ...
Reverse the year of birth and name, then print them in that order.
Reverse the year of birth using StringBuilder.reverse() method
Reverse the name using StringBuilder.reverse() method
Print the reversed year of birth followed by the reversed name
Threads in Java are lightweight sub-processes that allow concurrent execution within a single process.
Threads allow multiple tasks to be executed simultaneously in a Java program.
Threads share the same memory space and resources within a process.
Example: Creating a new thread using the Thread class or implementing the Runnable interface.
Developed a web application for inventory management system using Java Spring framework
Used Java Spring framework for backend development
Implemented RESTful APIs for communication between frontend and backend
Utilized MySQL database for storing inventory data
Using Java 8 Streams API to print single occurrences of names in an ArrayList of Strings.
Use stream() method on the ArrayList to create a stream of elements.
Use filter() method to filter out elements that occur more than once.
Use distinct() method to get only unique elements.
Use forEach() method to print each unique element.
Code to print each name and the number of occurrences in an ArrayList of Strings.
Iterate through the ArrayList and use a HashMap to store the count of each name.
Print each name along with its count from the HashMap.
Lambda expressions in Java are a concise way to represent anonymous functions.
Lambda expressions are used to provide implementation of functional interfaces.
They enable you to treat functionality as a method argument, or code as data.
Syntax: (parameters) -> expression or (parameters) -> { statements; }
Example: (int a, int b) -> a + b
Functional interfaces in Java are interfaces with only one abstract method, used for lambda expressions and functional programming.
Functional interfaces have only one abstract method, but can have multiple default or static methods.
They are used for lambda expressions and functional programming in Java.
Examples include java.lang.Runnable, java.util.Comparator, and java.util.function.Function.
Streams in Java are sequences of elements that support functional-style operations such as filter, map, reduce, etc.
Streams are not data structures, but rather a way to interact with collections of objects.
They allow for efficient processing of large amounts of data.
Streams can be sequential or parallel, allowing for concurrent processing.
Example: List
I am a Java Developer with 5 years of experience in developing web applications and implementing solutions using Java technologies.
5 years of experience in Java development
Strong knowledge of web application development
Experience in implementing solutions using Java technologies
My previous CTC was confidential as per company policy.
CTC was confidential as per company policy
I am unable to disclose my previous CTC
Previous CTC information is not available
I applied via Naukri.com and was interviewed in Sep 2024. There were 3 interview rounds.
I applied via Campus Placement
There was pattern question in any programming language and you have make the pattern dynamic.
I applied via Naukri.com and was interviewed in Oct 2023. There were 2 interview rounds.
I applied via Naukri.com and was interviewed in Sep 2022. There were 4 interview rounds.
MVC, OOPs concept, SQL queries are there in the first round.
Logical reasoning questions were there in the second round.
based on 1 interview
Interview experience
Software Developer
349
salaries
| ₹3 L/yr - ₹13.3 L/yr |
Software Analyst
183
salaries
| ₹2.5 L/yr - ₹8.9 L/yr |
Senior Software Developer
151
salaries
| ₹7 L/yr - ₹21 L/yr |
Java Developer
91
salaries
| ₹3.2 L/yr - ₹12 L/yr |
Senior Software Engineer
79
salaries
| ₹6.1 L/yr - ₹23 L/yr |
TCS
Infosys
Wipro
HCLTech