Interview questions and answers
- OOPS
- Abstraction
- Encapsulation
- Polymorphism
- Abstract Class
- Does Abstract class have constructor?
- Abstract class Vs Interface
- What to choose – interface or abstract class
- Why Java 8 has introduced default methods?
- Why Java 8 has introduced static methods?
- Why Java does not allow multiple inheritance?
- Method Overloading and Overriding
- Association
- Aggregation
- Composition
- Association vs. Aggregation vs. Composition
-
- Java 8
- Why String is Immutable?
- StringBuffer and StringBuilder
- equals and hashcode contract
- Comparable and Comparator interfaces
- static keyword
- Shallow Copy and Deep Copy
- Serialization and De-serialization
- Serialization scenarios with Inheritance
- How to make a class Immutable?
- Class loaders in Java
- Garbage Collector
- String, StringBuffer, StringBuilder
- Reflection
- Exceptions
- Generics
- Immutable object
- Pass by reference and Pass by value
- Shallow cloning and Deep cloning
- Instance variable and a Static variable
- Local variables vs Instance and static variables
- Access Modifiers
- Volatile keyword
- synchronized vs volatile
- Test
- Java 8
-
- Life Cycle of a Thread
- Creating a Thread
- Life Cycle of a Thread
- Creating a Thread
- Difference between Runnable vs Thread
- synchronized keyword
- static synchronization
- What does join() method?
- Deadlock
- How to avoid deadlock?
- What will happen if I directly call the run() method and not the start() method to execute a thread?
- Once a thread has been started can it be started again?
- Why wait, notify and notifyAll methods are defined in the Object class instead of Thread class?
- Why wait(), notify(), notifyAll() methods must be called from synchronized block?
- wait() vs sleep() methods
- Executor Framework
- Spring
- Dependency Injection
- BeanFactory and ApplicationContext
- Spring Bean life-cycle
- Spring Bean Scopes
- What happens when we inject a prototype scope bean in a singleton scope bean?
- How to inject a prototype scope bean in a singleton scope bean?
- Stereotype Annotations
- @Controller vs @RestController annotation
- @Qualifier annotation
- @Transactional annotation
- @ControllerAdvice annotation
- @Bean annotation
- @Component vs @Bean annotation
- Spring Boot Security using OAuth2 with JWT
- OAuth2 Terminology
- Json Web Token(JWT)
- Spring Boot Rest Authentication with JWT Token Flow
- Web server vs application server
- Spring Transaction Management
- @Autowired
- @Inject vs @Autowired
- Component Scanning
- @ComponentScan
- Difference between @Component, @Repository & @Service annotations?
- Spring MVC
- Spring MVC flow
- Spring Web Annotations
- Spring Boot
- Spring Boot Primary Goals
- Running Spring boot app at different port on server startup
- Key Spring Boot features
- Spring Boot Starters
- Spring Boot Autoconfiguration
- Easy-to-Use Embedded Servlet Container Support
- Spring Boot Annotations
- Building an Application with Spring Boot
- Spring Boot CRUD Web Application with Thymeleaf, Spring MVC, Spring Data JPA, Hibernate, MySQL
- Single-page application(SPA) vs. Multiple-page application(MPA)
- Angular
- AngularJS vs Angular
- AngularJS
- Angular
- Why Angular
- Angular Module
- Bootstrapping Module
- JIT vs AOT compilation
- Advantages of AOT
- What are the ways to control AOT compilation?
- How to optimize loading large data in angular?
- How an Angular application gets started or loaded?
- Angular Services
- What is Interpolation
- Angular Routing and Navigation
- Angular Component
- Angular Directive
- Angular Pipes
- Angular Data Binding
- Angular Lazy Loading
- Angular Lifecycle Hooks
- RxJS
- AngularJS vs Angular
- Design Patterns
- Microservices
-
How to send custom business errors or exceptions from a RESTful microservice to client application?
-
How to slowly move users from older version of application to newer version?
-
How will you troubleshoot a failed API request that is spread across multiple services?
-
Netflix Eureka Server : implement service discovery in microservices architecture
-
@RefreshScope : Refresh configuration changes on the fly in Spring Cloud environment
-
Achieve client side load balancing in Spring Microservices using Spring Cloud
-
client side load-balancer Ribbon in your microservices architecture
-
Use both LoadBalanced as well as normal RestTemplate object in the single microservice
-
- Why Basic Authentication is not suitable in Microservices Context?
- Why OAuth2?
- OAuth2 Roles
- OAuth 2.0 grant types (OAuth flows)
- When shall I use resource owner credentials?
- When shall I use Authorization Code grant?
- When shall I use client credentials?
- OAuth2 and Microservices
- What is JWT?
- What are use cases for JWT?
- How does JWT looks like?
- What is AccessToken and RefreshToken?
- How to use a RefreshToken to request a new AccessToken?
- How to call the protected resource using AccessToken?
- Can a refreshToken be never expiring? How to make refreshToken life long valid?
- Generate AccessToken for Client Credentials.
- Why there is no RefreshToken support in Oauth2 Client Credentials workflow?
- Security in inter-service communication
- API Gateway
- How to retry failed requests at some other available instance using Client Side Load Balancer?
- Circuit Breaker
- What is difference between using a Circuit Breaker and a naive approach where we try/catch a remote method call and protect for failures?
- Circuit Breaker Pattern
- Open, Closed and Half-Open states of Circuit Breaker
- Use-cases for Circuit Breaker Pattern
- Benefits of using Circuit Breaker Pattern
- What is Hystrix?
- Features of Hystrix library
- How to use Hystrix for fallback execution?
- When not to use Hystrix fallback on a particular microservice?
- ignore certain exceptions in Hystrix fallback execution
- Request Collapsing feature in Hystrix
- Circuit Breaker vs Hystrix
- Where exactly should I use Circuit Breaker Pattern?
- Where it should not be used?
- Kafka
-
-
- Frequently asked queries
- Find all departments with sales more than 1000
- Print all employee ids with their manager ids
- Print all manager names with count of directs
- Find Nth highest salary in SQL - Oracle, MSSQL and MySQL -Nth maximum salary in MySQL using LIMIT keyword -2nd highest salary in MySQL without subquery -3rd highest salary in MySQL using LIMIT clause -Test -Test -Test -Test
- Frequently asked queries
- Cucumber
- Advantages of Cucumber
- Example
- Features in Cucumber
- Feature file
- Step Definition
- Gherkin
- user login feature Example
- Test harness in Cucumber
- Selenium vs Cucumber
- TDD(Test-Driven Development)
- BDD and TDD
- Cucumber profiles
- Scenario Outline
- Scenario and Scenario Outline
- Step Definition
- Background in a Feature file
- Junit Test runner class
- Tags in cucumber-bdd
- Cucumber Hooks
- Name any two testing framework that can be integrated with Cucumber?
- What are the two files required to run a cucumber test?
- Examples Table or Scenario Outline vs Data Table
- Good Practices for REST API Design
- Accept and respond with JSON
- Use nouns instead of verbs in endpoint paths
- Nesting resources for hierarchical objects
- Handle errors gracefully and return standard error codes
- Allow filtering, sorting, and pagination
- Maintain Good Security Practices
- Cache data to improve performance
- Versioning our APIs
- Java code review checklist
- Common Java Vulnerabilities
- Resolving a Production Issue on a Live Server