Larsen & Toubro Limited
TechSpectra Interview Questions and Answers
Q1. OOPS Concepts of java and how we have implemented in the respective projects?
OOPS concepts are fundamental to Java programming. They are used in various projects to achieve code reusability and maintainability.
Encapsulation: Used to hide implementation details and protect data integrity.
Inheritance: Used to create a new class from an existing class, inheriting its properties and methods.
Polymorphism: Used to perform a single action in different ways, such as method overloading and overriding.
Abstraction: Used to provide a simplified view of complex sy...read more
Q2. What are sql joins and what are different kinds of joins?
SQL joins are used to combine data from two or more tables based on a related column.
Inner join returns only the matching rows from both tables
Left join returns all rows from the left table and matching rows from the right table
Right join returns all rows from the right table and matching rows from the left table
Full outer join returns all rows from both tables
Cross join returns the Cartesian product of both tables
Q3. How spring framework has been implemented in your project ?
Spring framework was used extensively in the project for dependency injection and MVC architecture.
Used Spring Boot for easy setup and configuration
Implemented Spring Security for authentication and authorization
Utilized Spring Data JPA for database operations
Used Spring MVC for handling HTTP requests and responses
Implemented Spring AOP for logging and exception handling
Q4. How map tables in the database with using hibernate orm?
Hibernate ORM maps tables in database using annotations or XML files.
Use @Entity annotation to map a class to a table
Use @Table annotation to specify the table name
Use @Column annotation to map a field to a column
Use @Id annotation to specify the primary key
Use @GeneratedValue annotation to specify the generation strategy for primary key
Use XML files for mapping if annotations are not preferred
Q5. What is difference between error and exception?
Errors are unrecoverable, while exceptions can be handled.
Errors are caused by the environment or JVM, while exceptions are caused by the application code.
Errors cannot be handled, while exceptions can be caught and handled using try-catch blocks.
Examples of errors include OutOfMemoryError and StackOverflowError, while examples of exceptions include NullPointerException and ArrayIndexOutOfBoundsException.
Q6. How to create connection pool using?
Connection pool can be created using libraries like Apache DBCP or HikariCP.
Choose a connection pool library based on your requirements.
Configure the pool size, maximum connections, and other settings.
Create a data source object and set the connection pool properties.
Use the data source object to get connections from the pool.
Close the connections after use to return them to the pool.
Q7. Explain Spring boot flow
Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured templates and dependencies.
Spring Boot uses an embedded server to run the application
It provides auto-configuration of dependencies
It uses annotations to configure the application
It supports various data sources and web frameworks
It simplifies the deployment process
Top Java Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month