What is Java? What are the main features of Java?
Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible.
Java features include object-oriented, platform independence, security, robustness, multithreading, and portability.
What is a Spring Boot starter?
A starter is a set of convenient dependency descriptors that you can include in your application to quickly set up a particular technology or functionality.
What is a repository in Git?
A repository is a storage location where Git keeps all the files and their revision history.
What is a SQL query?
A SQL query is a request to perform a specific action on a database to retrieve, manipulate, update, or manage data stored in that database.
What HTTP methods are commonly used in RESTful services?
GET, POST, PUT, DELETE, PATCH.
What is the difference between == and .equals() in Java?
What is the output of this code?
== compares references, while .equals() compares values
What is the application.properties file?
application.properties is a configuration file used to customize and configure various settings in a Spring Boot application.
What does git status do?
Shows the state of the working directory and staging area.
What does this query return?
The number of rows in the users table.
What HTTP status code indicates that a resource has been successfully created?
201.
Explain the output:
public class Main {
static int count = 0;
Main() {
count++;
}
public static void main(String[] args) {
new Main();
new Main();
System.out.println(count);
}
}
2 because variable count is static which means it is shared among all instances of the class
What will be the output when this endpoint is called?
Request: GET /hello
Hello World
What will happen with this command?
Creates and switches to a new branch named my_feature.
INNER JOIN vs LEFT JOIN vs FULL OUTER JOIN?
INNER JOIN returns matching rows. LEFT JOIN includes all left-table rows. FULL OUTER JOIN returns all records from both tables.
What is the difference between PUT and PATCH in REST?
PUT is used to update an entire resource, while PATCH is used to make partial updates to a resource.
Can we override a private method in Java?
No, private methods cannot be overridden because they are not visible to subclasses. However, if you define a method with the same name in a subclass, it is considered method hiding, not overriding.
What is Dependency Injection in Spring?
Dependency Injection (DI) is a design pattern in Spring where the container injects the dependencies needed by a class at runtime.
What does git rebase do?
git rebase rewrites commit history, moves your branch on top of another branchMoves or reapplies commits on top of another base tip.
What is a subquery?
A subquery is a query nested inside another query.
What’s the difference between PUT and POST in RESTful APIs? Which is idempotent?
PUT is idempotent and updates/replaces. POST creates and is not idempotent.
Explain Java architecture
The Java architecture includes the three main components:
Java Virtual Machine (JVM): Write Once Run Anywhere.
Java Runtime Environment (JRE): It provides an environment in which Java programs are executed. JRE takes our Java code, integrates it with the required libraries, and then starts the JVM to execute it.
Java Development Kit (JDK): used in the development of Java applications and applets. Java Development Kit holds JRE, a compiler, an interpreter or loader, and several development tools in it.
What is Bean in SpringBoot and how to define it?
A Bean is an object managed by the Spring IoC container.
A Bean can be defined using the @Bean annotation in a configuration class or by annotating the class with @Component, @Service, or @Repository.
What is the purpose of git cherry-pick?
git cherry-pick allows you to apply a specific commit from one branch to another.
Given a million-user table, how would you optimize a query searching by email?
Add an index on the `email` column to speed up
What is CORS, and why might it block a request?
Cross-Origin Resource Sharing; it blocks a request if the origin is not allowed by the server for security reasons.