MindGate Solutions
Interview Questions and Answers
Q1. What are 4 pillors of oops concept? And explain them with example.
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: Creating new classes from existing ones, inheriting their...read more
Q2. What is difference between array and collection?
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 for manipulation.
Arrays are part of the core Java language, ...read more
Q3. Is string mutable or immutable? And why?
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.
Q4. What is multi threading?
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
Q5. Steps for jdbc to connect database.
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
Q6. Difference between collection and map.
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 corresponding name.
Q7. Life cycle of thread.
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 terminated and move to the dead state when it completes its exec...read more
Q8. Oops concept in Java program
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 superclass.
Abstraction focuses on the essential characteristics o...read more
Reviews
Interviews
Salaries
Users/Month