Wednesday, October 12, 2022

Interview Preparation: Senior Developer, Full Stack Developer

Core Java Basic

  1.  JDK, JRE , JVM and architecture ( link)
  2.  Classloader and its types (link)
  3.  Java Args -X, -XX, -D link
  4.  Local variable, instance variable, static variable difference?
  5.  Why java is not pure object oriented language
  6.  Object Oriented vs Object Based language
  7.  Thread Memory [thread memory
  8.  Java memory [young, old]  [link] [metaspace instead of permgen]
  9. Garbage Collection link1
  10. Strategy and Types [ Types:{Serial, parallel, CMS, G1}, Strategy: oldGen, young gen, permgen[link]
  11.  Constructor (super, this) [link1]
  12.  Characteristics of OOP (Encapsulation, Abstraction , inheritance, polymorphism) [link]
  13.  Types of Polymorphism(static vs dynamic or overloading vs overrriding vs operator overloading) [link]
  14.  Covariant Type and contravarient type [link]
  15. Interface vs Abstract
  16. Interface: default method, static methods, private method, marker[link]
  17. Exception Handling(checked and unchecked link[link2]
  18. String concept : [link]
  19. String Constant pool
  20. StringBuilder and StringBuffer
  21. Equals vs == [link]
  22. Equals and Hashcode [link]
  23. Inner Class and types [link]
  24. Serialisation and Deserialisation[Serial&Deserial]
  25. Reflection [link]
  26. final, finally, finalize[final-java]
  27. transient,volatile[link]
  28. native, strictfp[link]
  29. Java: passby value[passbyvalue]
  30. fail-fast, fail-safe [fail fast safe]
  31. Comparable, comparator[link]
  32. Functional Programming: Supplier, Consumer, Predicate, Function[functional program]
  33. Aggregation vs composition vs Association[link]
  34. Thread [Introductionwait notify
  35. Runnable, Callable, Future, Executor
  36. Synchronisation
  37. 1LserialversionUID link
  38. Concurrency
  39. Collection framework
  40. Create singleton class while preventing reflection api link
  41. Java 8, 11, 17, 21 and latest java  link
  42. Parallelstream vs stream link
  43. java8 Collectors.groupingBy, distinct(), parrallelStream()





Collection Framework

  • Basic Into link
  • HashTable [link] thread safe, method lock
  • HashMap link1, link2  {uses linkedlist, then RB tree, not threadsafe hashtable}
  • HashSet [link ]
  • LinkedHashMap [link ] work as double linkedlist [array of doublinkedlist], maintain order
  • LinkedHashSet [link]
  • ConcurrentHashmap [link] is an extension of hashtable with better synchronised version than hashtable[segment lock instead of methd or block lock]
  • TreeMap: internally uses RB Tree [link]
  • TreeSet: The data structure for the TreeSet is TreeMap; it contains SortedSet & NavigableSet interface to keep the elements sorted in ascending order and navigated through the tree.
  • Sort hashmap with custom key object. hashmap has customer object as key then immutable object because of this reason string is preferred as key
  • Sort hashmap by values. link
  • Hashtable{method level locl} vs synchronisedhashMap{block level lock also supported} vs concurrenthashmap{segment lock} vs linkedhashmap vs treemap link

 

Thread and synchronization
  • Basic Intro link with detail
  • Concurrency vs Parallelism [link
  • Types of synchronisation: static sync, sync block, sync method
  • Object: wait, notify, notifyAll.  [Inter Thread communication link]
  • Thread: yield, join link.  
  • Threadpool example link
  • Two thread accessing synchronise method
  • Cyclic Barrier vs CountDownLatch link

Concurrency
    • Basic link
    • Executors framework link
    • Executors vs executor
    • Concurrentmodification exception
    • Unsupported operation exception
    • Future vs CompletableFuture link


********************************************************************************

Spring Boot Framework


  • Sync, Async, Reactive programming
  • Spring IOC container(ApplicationContext interface) link
  • Dependency Injection  types: constructor, setter, field based DI
  • Bean scopes link1  link2
  • Bean lifecyle link
  • Dispatcher servlet link
  • @Controller, @RestController, @Service,@Repository link
  • Lazy loading link
  • Spring multiple datasource link link2 link3
  • Load time invoking functionality link2 link1 
  • Spring webflux link link2 
  • Spring JPA link link2 [used for JDBC]
  • Spring R2dbc link link [prefered ]
  • Spring Webclient link
  • Spring transaction mgmt link
  • Spring batch processing link link2
  • Spring logging framework(logback is default) link
  • Spring exception handling link
  • Spring testing framework link
  • @Springbootapplication annotation  
     @EnableAutoConfiguration,@ComponentScan,@Configuration
  • Spring swagger [openapi documentation- latest] link
  • Spring redis link1  lettuce link 2
  • Spring kafka link
  • Spring AOP link
  • Spring boot security with JWT link
  • Spring security  intro basic  weblfux oauth2 jwt 
  • Put vs post vs patch link
  • Commandline runner vs Applicationrunner link
  • Spring elastic searchlink


*********************************************************************************


Authentication Framework




Authentication Framework

 Authentication vs Authorisation

 Application in Microservice : 

https://medium.com/geekculture/securing-your-microservices-architecture-with-spring-boot-an-in-depth-guide-to-authentication-and-d4acd8cf7efb

https://medium.com/javarevisited/spring-boot-authorization-creating-an-authorization-server-for-your-microservices-50a3aefd6ce8


******************************************************************************

React and Redux


  • Hello world Concept example webpack example
  • React VirtualDom link
  • Virtual DOM vs Shadow DOM link
  • Reconciliation: diffy algo in fibre node
  • Higher order components link
  • hoisting link
  • let vs var link [hoisting happens in var]
  • API call (axios) link
  • Webpack link link2
  • Babel link  
  • useMemo, useCallback, useContext link
  • Redux::: action , store, dispatcher, reducer [useReducer] Explaination
  • CORs for protection
  • Testing framework for FE testinglib link enzyme
  • React vs Angular vs vue link
  • Typescript link
  • Microfrontend design link Eg:Module federation, single-spa
  • Def between useRef and useState link [useref doesnt cause re rerendering of page]
  • useMemo vs useCallback [useCallback hook memoizes function itself, not its return value like use memo]
  • type vs interface in typescript
  • interface vs class
    Testing framework FE
    • Jest: Best for unit testing and snapshot testing with easy configuration
    • Mocha: Best for flexible, customizable test setups with asynchronous support
    • Enzyme: Best for testing React component internals with shallow and full rendering
    • TestCafe: Best for cross-browser testing and end-to-end testing with simple setup
    • Jasmine: Best for behavior-driven development (BDD), focusing on simplicity
    • Chai: Best for expressive assertions in tests using BDD/TDD style
    • Cypress: Best for fast, reliable end-to-end testing with real-time browser interaction
    • Puppeteer: Best for headless browser automation and UI testing
    • React Testing Library: Best for testing React components through user interactions
    • Sinon: Best for mocking, spying, and stubbing external dependencies in tests
    • Nightwatch.js: Best for simple end-to-end testing with WebDriver integration
    • QUnit: Best for straightforward unit testing, especially in legacy projects
    • Storybook: Best for visually testing and documenting UI components in isolation
    • Ava: Best for fast, concurrent testing with minimal configuration
    • Detox: Best for end-to-end testing of mobile apps, particularly React Native, with fast test execution.
Note- The algorithm React uses to diff one tree with another to determine which parts need to be changed also k/a reconciliation. .JavaScript is a dynamically typed language. In a dynamically typed language, the type of a variable is checked during run-time in contrast to a statically typed language, where the type of a variable is checked during compile-time.In JavaScript, primitive data types are passed by value and non-primitive data types are passed by reference.Functions that operate on other functions, either by taking them as arguments or by returning them, are called higher-order functions.Memoization is a form of caching where the return value of a function is cached based on its parameters. If the parameter of that function is not changed, the cached version of the function is returned.
 
   React virtual DOM uses Fibre node as internal data structure. Its a tree of single linkedlist node
 npx webpack --env prod

 

-----------------------------------------------------

SQL link

  • Explain the differences between SQL and NoSQL databases.
  • Types of join link
  • SQL vs PSQL vs TSQL link
  • Unique key vs Primary key
  • Where vs Having in sql
  • Delete, truncate, drop [Drop removes table structure as well, truncate for all data]
  • SQL INTO
  • Nth highest salarylink
  • On delete cascade
  • How do you optimize SQL queries? link1 link2
  • How do u handle transaction in distributed system [SAGA, 2PC]
  • How do you prevent SQL injection link
  • Condept of sharding link
  • Condept of partitioning link
  • SQL concept quesn link
  • SQL query query interview
  • SQL query to find last 3 month data 
  • JOIN is a shorthand for INNER JOIN in PostgreSQL

SELECT
FROM
WHERE
GROUP BY
HAVING
ORDER BY


SELECT column1, column2, ... INTO new_table_name FROM existing_table WHERE condition;

SELECT employees.emp_name, departments.dept_name FROM employees JOIN departments ON employees.dept_id = departments.dept_id; 


Note:
Managing large-scale databases for performance involves various strategies, including proper indexing, partitioning, query optimization, hardware optimization, and caching. Monitoring and fine-tuning the database is crucial to ensure optimal performance as data volumes grow.

Ensuring data availability and disaster recovery relies on the implementation of vital backup and recovery strategies. These strategies encompass various methods, such as full backups, differential backups, transaction log backups, and regular testing of restoration procedures.

NoSQL databases are non-relational databases designed for handling large volumes of unstructured or semi-structured data. They interact with SQL databases through various integration methods, such as data pipelines, ETL processes, and API-based data transfers

Advanced optimization techniques for SQL queries include using query hints, indexing strategies, query rewriting, and understanding the query execution plan. Profiling tools and performance monitoring are essential for identifying and resolving performance bottlenecks

The INTO clause creates a new table, not just inserts data into an existing one 

*******************************************************************************

Security in Web Application



*************************************************

SOLID principle


Single Responsibility Principle

Each class should be responsible for a single part or functionality of the system

Open-Closed Principle

Software components should be open for extension, but not for modification.

Liskov Substitution Principle

Objects of a superclass should be replaceable with objects of its subclasses without breaking the system.

Interface Segregation Principle

No client should be forced to depend on methods that it does not use.

Dependency Inversion Principle

High-level modules should not depend on low-level modules, both should depend on abstractions.

Explain with Eg: Vechile, Bank link
                                          

*************************************************


Design Pattern in Java(GOF pattern) 

Design patterns are typical solutions to commonly occurring problems in software design. They are like pre-made blueprints that you can customize to solve a recurring design problem in your code. Usage examples in java  link 

  1. Creational Design pattern:  are concerned with the way of creating objects.
    Singleton, Builder, Factory pattern, Abstract Fcatory link link2

  2. Structural Design patternThese patterns explain how to assemble objects and classes into larger structures while keeping these structures flexible and efficient.
    Adopter, Decorator, Facade, Composite, Bridge, flyweight design pattern  link

  3. Behavioural Design patternare concerned with the interaction and responsibility of objects.
    Observer, Iterator, ChainOfResponsibility, Strategy, Command link

     Extralink





Microservice Design Pattern

Microservices is an architectural style for building applications as a collection of independent services. Each service is built and deployed independently, and can be scaled independently



use chatgpt directly to study about all

     

*************************************************
12 factor Apps




*************************************************

System Design round

************************************************


Additional Topic Note:

  • Architect Interview javafungus
  • Data Engineering javafungus
  • Databases javafungus
  • Reverse proxy vs forward proxy
  • Brownfield vs greenfield microservice app development
  • KISS, DRY, SOLID, YAGNI link
  • Code review link
  • Component Cohesion & Coupling link
  • Implement OAuth 2.0 authentication for a Spring Boot REST API using JWT tokens

  • Name any recent cyberattack you heard of






























































Data Engineering and Best practices

Data and types Data at rest (e.g. batch data pipelines / data stored in warehouses or object stores) Data in motion (e.g. streaming pipeline...