Full Stack Interview

1. OOPs Concept in Java (Real Time Examples
Object-Oriented Programming System (OOPs) is a programming concept that works on the principles of abstraction, encapsulation, inheritance, and polymorphism. It also uses different approach to handle Real world problems by using Objects and Classes unlike POP which uses Structures and Methods
2. Abstraction
Abstraction “displays” only the relevant attributes of objects and “hides” the unnecessary details.
For example, when we are driving a car, we are only concerned about driving the car like start/stop the car, accelerate/ break, etc. We are not concerned about how the actual start/stop mechanism or accelerate/brake process works internally. We are just not interested in those details. What we are concerned about is the “abstract” view of these operations that will help us to propel the car forward and reach our destination. This is a simple example of abstraction.
We can have Abstract Methods and Abstract classes but not variables.
3. Encapsulation
Encapsulation in Java is a process of wrapping code and data together into a single unit, we can create a fully encapsulated class in Java by making all the data members of the class private. Now we can use setter and getter methods to set and get the data in it.
For example, School bag is one of the most real examples of Encapsulation. School bag can keep our books, pens, etc.
The Java Bean class is the example of a fully encapsulated class.
4. Inheritance
Inheritance in Java is a mechanism in which one object acquires all the properties and behaviors of a parent object. It is mainly used to achieve reusability of code. The idea behind inheritance in Java is that you can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. Moreover, you can add new methods and fields in your current class also.
5 types of Inheritance: Single, Multilevel, Hierarchical, Multiple, Hybrid.
For example, In real world We can take Car as an example. Where car will be the base class and its models will be the derived class.
5. Polymorphism
Polymorphism in Java is the ability of a variable, object or function to take on multiple forms. For example, in English, the verb run has a different meaning if you use it with a laptop, a foot race, and business. Here, we understand the meaning of run based on the other words used along with it. The same also applied to Polymorphism.
For example, There can be two person named Utkarsh in a single class which both can have different properties like one would be good singer and another would be a good dancer.
6. Association
Association is a relationship between two objects. It is one of the OOP Concepts in Java which defines the diversity between objects. In this OOP concept, all objects have their separate lifecycle, and there is no owner. For example, many students can associate with one teacher while one student can also associate with multiple teachers.
7. Aggregation
n this technique, all objects have their separate lifecycle. However, there is ownership such that child object can’t belong to another parent object. For example, consider class/objects department and teacher. Here, a single teacher can’t belong to multiple departments, but even if we delete the department, the teacher object will never be destroyed.
8. Composition
Composition is a specialized form of Aggregation. It is also called “death” relationship. Child objects do not have their lifecycle so when parent object deletes all child object will also delete automatically. For that, let’s take an example, of House and rooms. Any house can have several rooms. One room can’t become part of two different houses. So, if you delete the house room will also be deleted.
9. Array and ArrayList
Array is a fixed length data structure whereas ArrayList is a variable length Collection class. We cannot change length of array once created in Java but ArrayList can be changed. We cannot store primitives in ArrayList, it can only store objects.
10. Java Version
Java 18
11. Thread and Multithread
Threads allows a program to operate more efficiently by doing multiple things at the same time. Single thread executes tasks of a process while in multi-thread, multiple threads execute the tasks of a process.
12. Ways to create Thread.
There are two ways to create a thread:
By extending Thread class:
class Multi extends Thread {
public void run() {
System.out.println(“thread is running…”);
}
public static void main(String args[]) {
Multi t1 = new Multi();
t1.start();
}
}
By implementing Runnable interface:
class Multi3 implements Runnable {
public void run() {
System.out.println(“thread is running…”);
}
public static void main(String args[]) {
Multi3 m1 = new Multi3();
Thread t1 = new Thread(m1); // Using the constructor Thread(Runnable r) t1.start(); } }
13. Exception Handling in Java
The Exception Handling in Java handle the runtime errors so that the normal flow of the application can be maintained.
For example, If we going to have some code which can possibly have some error on runtime its better to have exception handling mechanism implemented on the code to avoid runtime error. We can use try catch block to handle runtime exception. Other keywords used are throw throws and finally.
14. Loggers in Java
Logging is used to trace out the errors in the program.
15. Spring Framework
The Spring framework can be considered as a collection of sub-frameworks, also called layers, such as Spring AOP. Spring Object-Relational Mapping (Spring ORM). Spring Web Flow, and Spring Web MVC. It is a lightweight application framework used for developing enterprise applications. You can use any of these modules separately while constructing a Web application. The modules may also be grouped together to provide better functionalities in a Web application. Spring framework is loosely coupled because of dependency Injection.
https://www.geeksforgeeks.org/introduction-to-spring-framework/
16. React JS
React is a JavaScript library for building user interfaces.
React is used to build single-page applications.
React allows us to create reusable UI components.
React Tutorial (w3schools.com)
17. Dependency Injection
Dependency Injection is the main functionality provided by Spring IOC(Inversion of Control). The Spring-Core module is responsible for injecting dependencies through either Constructor or Setter methods. The design principle of Inversion of Control emphasizes keeping the Java classes independent of each other and the container frees them from object creation and maintenance. These classes, managed by Spring, must adhere to the standard definition of Java-Bean. Dependency Injection in Spring also ensures loose-coupling between the classes.
Need for Dependency Injection:
Suppose class One needs the object of class Two to instantiate or operate a method, then class One is said to be dependent on class Two. Now though it might appear okay to depend a module on the other but, in the real world, this could lead to a lot of problems, including system failure. Hence such dependencies need to be avoided.
18. Table Structure in HTML

19. Spring MVC
A Spring MVC is a Java framework which is used to build web applications. It follows the Model-View-Controller design pattern. It implements all the basic features of a core spring framework like Inversion of Control, Dependency Injection.
A Spring MVC provides an elegant solution to use MVC in spring framework by the help of DispatcherServlet. Here, DispatcherServlet is a class that receives the incoming request and maps it to the right resource such as controllers, models, and views.
20 Maven
Maven is a popular open-source build tool developed by the Apache Group to build, publish, and deploy several projects at once for better project management. The tool provides allows developers to build and document the lifecycle framework.
21 How to Log msgs in program
In Java, Logging is an API that provides the ability to trace out the errors of the applications. When an application generates the logging call, the Logger records the event in the LogRecord. After that, it sends to the corresponding handlers or appenders. Before sending it to the console or file, the appenders format that log record by using the formatter or layouts.
22 Hibernate Framework
Hibernate is a Java framework that simplifies the development of Java application to interact with the database. It is an open source, lightweight, ORM (Object Relational Mapping) tool. Hibernate implements the specifications of JPA (Java Persistence API) for data persistence.
23 Spring Cloud Concepts
Spring Cloud–an open-source library–makes it easy to develop JVM applications for the cloud. With it, applications can connect to services and discover information about the cloud environment easily in multiple clouds such as Cloud Foundry and Heroku.
Features:
- Distributed/versioned configuration.
- Service registration and discovery.
- Routing.
- Service-to-service calls.
- Load balancing.
- Circuit Breakers.
- Global locks.
- Leadership election and cluster state
24 Difference between Abstraction and Interface

25. Final Super Static Keyword.
Final: The final keyword is a non-access modifier used for classes, attributes and methods, which makes them non-changeable (impossible to inherit or override).
The final keyword is useful when you want a variable to always store the same value, like PI (3.14159…).
The final keyword is called a “modifier”.
Static: The static keyword is a non-access modifier used for methods and attributes. Static methods/attributes can be accessed without creating an object of a class.
Super: The super keyword refers to superclass (parent) objects.
It is used to call superclass methods, and to access the superclass constructor.
The most common use of the super keyword is to eliminate the confusion between superclasses and subclasses that have methods with the same name.
26 Different Access Modifier
Private: The access level of a private modifier is only within the class. It cannot be accessed from outside the class.
Default: The access level of a default modifier is only within the package. It cannot be accessed from outside the package. If you do not specify any access level, it will be the default.
Protected: The access level of a protected modifier is within the package and outside the package through child class. If you do not make the child class, it cannot be accessed from outside the package.
Public: The access level of a public modifier is everywhere. It can be accessed from within the class, outside the class, within the package and outside the package.
27 Method Overloading & Advantage
If a class has multiple methods having same name but different in parameters, it is known as Method Overloading.
Advantage:
If we have to perform only one operation, having same name of the methods increases the readability of the program.
28 Method Overriding & Advantage
If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in Java.
In other words, If a subclass provides the specific implementation of the method that has been declared by one of its parent class, it is known as method overriding.
Advantage:
Method overriding is used to provide the specific implementation of a method which is already provided by its superclass. Method overriding is used for runtime polymorphism.
29. Create List in HTML

30. Triggers in textbox
HTML has the ability to let events trigger actions in a browser, like starting a JavaScript when a user clicks on an element.
HTML Event Attributes (w3schools.com)
31 Difference in Equals and Double Equals
Equals is used as Assignment operator whereas Double Equals is used as Comparison Operator.
32 Different Logger or Log4j Levels in Java

33. Find Highest and Second Highest num in SQL
Highest: SELECT MAX(items) as max_items FROM product;
Second Highest: SELECT MAX(SALARY) FROM Employee WHERE SALARY < (SELECT MAX(SALARY) FROM Employee);
34 Keys in SQL
In SQL, keys are the set of attributes that used to identify the specific row in a table and to find or create the relation between two or more tables i.e keys identify the rows by combining one or more columns.
Primary Key is a field that can be used to identify all the tuples uniquely in the database. Only one of the columns can be declared as a primary key. A Primary Key can not have a NULL value.
Unique Key can be a field or set of fields that can be used to uniquely identify the tuple from the database. One or more fields can be declared as a unique Key. The unique Key column can also hold the NULL value. Use of Unique Key improves the performance of data retrieval. It makes searching for records from the database much more faster & efficient.
Candidate Key can be a column or group of columns that can qualify for the Unique Key. Every table has at least one Candidate Key. A table may have one or more Candidate Key. Each Candidate Key can work as a Primary Key if required in certain scenarios.
Alternate Key is that Key which can be used as a Primary Key if required. Alternate Key also qualifies to be a Primary Key but for the time being, It is not the Primary Key.
Composite Key is also known as Compound Key / Concatenated Key. Composite Key refers to a group of two or more columns that can be used to identify a tuple from the table uniquely. A group of the column in combination with each other can identify a row uniquely but a single column of that group doesn’t promise to identify the row uniquely.
Super Key is a combination of columns, each column of the table remains dependent on it. Super Key may have some more columns in the group which may or may not be necessary to identify the tuple uniquely from the table. Candidate Key is the subset of the Super Key. Candidate Key is also known as minimal Super Key.
A foreign key is a column which is known as Primary Key in the other table i.e. A Primary Key in a table can be referred to as a Foreign Key in another table. Foreign Key may have duplicate & NULL values if it is defined to accept NULL values.
35 Spring Lifecycle
Bean life cycle is managed by the spring container. When we run the program then, first of all, the spring container gets started. After that, the container creates the instance of a bean as per the request, and then dependencies are injected. And finally, the bean is destroyed when the spring container is closed. Therefore, if we want to execute some code on the bean instantiation and just after closing the spring container, then we can write that code inside the custom init() method and the destroy() method.

36 Difference between Spring Boot and Spring MVC

37. Why use Spring Boot
Spring boot provides all the default configuration and dependencies required to run our Application. There is no need to build configuration manually and it wraps dependencies together in a single unit. By this it reduces development time and increase productivity.
38. Bind Function in JS
With the bind() method, an object can borrow a method from another object.
Preserving this
Sometimes the bind() method has to be used to prevent loosing this.
To avoid using Bind function we can also use arrow functions while writing our code.
39. Fibonacci Series Program
class FibonacciExample1 {
public static void main(String args[]) {
int n1 = 0, n2 = 1, n3, i, count = 10;
System.out.print(n1 + “ “ + n2); //printing 0 and 1
for (i = 2; i < count; ++i) //loop starts from 2 because 0 and 1 are already printed
{
n3 = n1 + n2;
System.out.print(“ “ + n3);
n1 = n2;
n2 = n3;
}
}
}
40. Collections in Java
The Collection in Java is a framework that provides an architecture to store and manipulate the group of objects.
Java Collections can achieve all the operations that you perform on a data such as searching, sorting, insertion, manipulation, and deletion.
Java Collection means a single unit of objects. Java Collection framework provides many interfaces (Set, List, Queue, Deque) and classes (ArrayList, Vector, LinkedList, PriorityQueue, HashSet, LinkedHashSet, TreeSet).
41. Props and States in React
Props are used to pass data, whereas state is for managing data. Data from props is read-only, and cannot be modified by a component that is receiving it from outside. State data can be modified by its own component, but is private (cannot be accessed from outside)
42. JPA
JPA is just a specification that facilitates object-relational mapping to manage relational data in Java applications. It provides a platform to work directly with objects instead of using SQL statements.
43. JDBC
JDBC stands for Java Database Connectivity. JDBC is a Java API to connect and execute the query with the database.
We can use JDBC API to access tabular data stored in any relational database. By the help of JDBC API, we can save, update, delete and fetch data from the database. It is like Open Database Connectivity (ODBC) provided by Microsoft.
44. RestFull
A RESTful API is an architectural style for an application program interface (API) that uses HTTP requests to access and use data. That data can be used to GET, PUT, POST and DELETE data types, which refers to the reading, updating, creating and deleting of operations concerning resources.
A RESTful API — also referred to as a RESTful web service or REST API — is based on representational state transfer (REST), which is an architectural style and approach to communications often used in web services development. REST technology is generally preferred over other similar technologies. This tends to be the case because REST uses less bandwidth, making it more suitable for efficient internet usage. RESTful APIs can also be built with programming languages such as JavaScript or Python.
Annotations:
@RequestMapping: It is used to map the web requests. It has many optional elements like consumes, header, method, name, params, path, produces, and value. We use it with the class as well as the method.
45. Springboot Annotations
Spring Boot Annotations is a form of metadata that provides data about a program. In other words, annotations are used to provide supplemental information about a program. It is not a part of the application that we develop. It does not have a direct effect on the operation of the code they annotate. It does not change the action of the compiled program.
Annotations:
@Required: It applies to the bean setter method. It indicates that the annotated bean must be populated at configuration time with the required property, else it throws an exception BeanInitilizationException.
@Autowired: Spring provides annotation-based auto-wiring by providing @Autowired annotation. It is used to autowire spring bean on setter methods, instance variable, and constructor. When we use @Autowired annotation, the spring container auto-wires the bean by matching data-type.
@Configuration: It is a class-level annotation. The class annotated with @Configuration used by Spring Containers as a source of bean definitions.
@Bean: It is a method-level annotation. It is an alternative of XML tag. It tells the method to produce a bean to be managed by Spring Container.
For all annotations:
46 Java Beans
Java developers needed to use JavaBeans to create Web applications. Although JavaBeans helped in the development of user interface (UI) components, they were not able to provide services, such as transaction management and security, which were required for developing robust and secure enterprise applications.
47 Joins in SQL

48 Axios
Axios is a promise based HTTP client for the browser and Node. js. Axios makes it easy to send asynchronous HTTP requests to REST endpoints and perform CRUD operations. It can be used in plain JavaScript or with a library such as Vue or React.