Design Pattern
Thursday, June 13, 2024 in Java Interview Questions
Design Pattern Singleton Pattern A creational pattern that restricts the instantiation of a class to a single instance eg. beans in IoC Container Decorator Pattern A structural pattern that allows behavior to be added to an individual object, …
SOLID Principle
Thursday, June 13, 2024 in Java Interview Questions
SOLID Principle Single Responsibility Principle A class should have only one reason to change Open Closed Principle Software entities should be open for extension, but closed for modification Liskov Substitution Principle Objects of a superclass …
Grouping Rows With Same Values In Specified Columns
Thursday, June 13, 2024 in SQL Server Interview Questions
Grouping Rows With Same Values In Specified Columns SELECT col1_name, SUM(col2_name) FROM table_name GROUP BY col1_name; -- `GROUP BY` is used with aggregate functions to perform calculations on the grouped data -- every column in the SELECT clause …
Consume REST Services
Thursday, June 13, 2024 in Spring Interview Questions
Consume REST Services RestTemplate Synchronous client WebClient Asynchronous client, part of Spring WebFlux FeignClient Synchronous and declarative client, part of Spring Cloud
I/O
Thursday, June 13, 2024 in Java Interview Questions
I/O Java I/O is built around the concept of streams, which are sequences of data Type Byte Streams InputStream and its subclasses OutputStream and its subclasses Character Streams Reader and its subclasses Writer and its subclasses Buffered streams …
Aggregate Function
Thursday, June 13, 2024 in SQL Server Interview Questions
Aggregate Function Perform a calculation on a set of values and return a single value SELECT AVG(col_name) FROM table_name -- we can use `AVG`, `MIN`, `MAX`, `SUM`, `COUNT` COUNT(*) Counts the total number of rows in the result set, even if some of …
@Transactional
Thursday, June 13, 2024 in Spring Interview Questions
@Transactional @Transactional on method means that the entire method will run in a single transaction. If any exception occurs during the execution of this method, the transaction will be rolled back, ensuring data consistency
Sorting Results
Thursday, June 13, 2024 in SQL Server Interview Questions
Sorting Results SELECT * FROM table_name ORDER BY col_name ASC; -- can use `ASC`, `DESC` SELECT column1, column2, column3 FROM table_name ORDER BY column1, column2 DESC, column3 ASC; -- ascending is the default sort order -- can `ORDER BY` multiple …
Multithreading
Thursday, June 13, 2024 in Java Interview Questions
Multithreading Multithreading is a Java feature that allows concurrent execution of two or more threads for maximum utilization of the CPU Process vs Thread A process is an executing program. It has its own memory space and resources A thread is a …
Interceptor
Thursday, June 13, 2024 in Spring Interview Questions
Interceptor Interceptors in Spring allow you to intercept HTTP requests and responses Step Create a class which implement the HandlerInterceptor interface @Component public class MyInterceptor implements HandlerInterceptor { @Override public boolean …