Excelon Solutions
10+ Digital Folks Interview Questions and Answers
Q1. Write code to get the Dept from Dept table where dept id in emp and Dept table point to the same employee
Join Dept table with emp table on dept id to get department of employees
Use SQL JOIN to connect Dept and emp tables on dept id
Select the Dept column from Dept table to get the department of employees
Q2. Write code to add employee table into the db using Spring boot app and retrieve data of employee with the second highest salary
Code to add employee table in db using Spring Boot app and retrieve data of employee with second highest salary
Create Employee entity class with fields like id, name, salary
Create EmployeeRepository interface extending JpaRepository
Implement service class with methods to add employee to db and retrieve employee with second highest salary
Use @Query annotation in repository to write custom query to retrieve employee with second highest salary
Q3. Why is there no multiple inheritance in Java?
Java does not support multiple inheritance to avoid the diamond problem and maintain simplicity and clarity in the language.
Java supports single inheritance to prevent the diamond problem, where conflicts arise when a class inherits from two classes that have a common ancestor.
Multiple inheritance can lead to ambiguity and complexity in the code, making it harder to understand and maintain.
Java allows multiple interface inheritance to achieve code reusability without the issu...read more
Q4. Explain difference between final, finalize and finally
final is a keyword used to declare constants, finalize is a method used for cleanup operations, and finally is a block used for exception handling.
final is used to declare constants in Java
finalize is a method in Java used for cleanup operations before an object is garbage collected
finally is a block used in exception handling to ensure a piece of code is always executed
Q5. Difference between Spring and Spring boot frameworks
Spring is a framework for building Java applications, while Spring Boot is an extension that simplifies the setup and development process.
Spring is a comprehensive framework that provides support for various Java technologies like JDBC, JPA, and REST.
Spring Boot is an opinionated extension of Spring that aims to simplify the setup and development of Spring applications by providing defaults for configuration.
Spring Boot includes embedded servers like Tomcat, Jetty, or Underto...read more
Q6. How to connect db to Springboot app
Use Spring Data JPA to connect a database to a Spring Boot application.
Add the necessary dependencies in the pom.xml file for Spring Data JPA and the database driver.
Configure the database connection properties in the application.properties file.
Create a repository interface that extends JpaRepository to interact with the database.
Use annotations such as @Entity, @Table, @Id, @Column, etc., to map Java objects to database tables.
Inject the repository interface into your servi...read more
Q7. Difference between static and non static methods
Static methods belong to the class itself, while non-static methods belong to instances of the class.
Static methods can be called without creating an instance of the class.
Non-static methods require an instance of the class to be created before they can be called.
Static methods cannot access instance variables, while non-static methods can.
Example: Math.sqrt() is a static method, while String.length() is a non-static method.
Q8. Difference between constructor and method
Constructor is a special method used to initialize an object, while a method is a function associated with an object to perform a specific task.
Constructor is called automatically when an object is created, while a method is called explicitly by the programmer.
Constructors have the same name as the class, while methods have unique names.
Constructors do not have a return type, while methods can have a return type.
Example: Constructor - public ClassName() { // initialization co...read more
Q9. Different injections in Spring boot
Different types of injections in Spring Boot include constructor injection, setter injection, and field injection.
Constructor injection: Dependencies are provided through a class constructor.
Setter injection: Dependencies are set through setter methods.
Field injection: Dependencies are injected directly into class fields.
Q10. Different access keywords for methods
Access keywords control the visibility and accessibility of methods in a class.
public: accessible from any class
private: only accessible within the same class
protected: accessible within the same class and its subclasses
default (no keyword): accessible within the same package
Top Software Developer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month