Hi friends. Recently, I have given interview @ SirionLabs, Gurgaon.
So, sharing all the interview questions asked in SirionLabs here.
Questions are mainly on Architectural designs.
You can also go through my other interview posts:
Question 1:
What is the difference between Saga and 2 Phase Commit patterns?
Answer:
Saga and 2 Phase Commit patterns are used for distributed transactions.
A distributed transaction would do what a transaction would do but on multiple databases.
Differences:
Question 2:
Which database should be used when storing billions of payment requests come to database and why?
Answer:
In this case, data is relational in nature like payment amount, user id, payment date, payment location, account number etc.
So, I can easily use SQL Server 2016 with proper indexes on proper fields.
Question 3:
Which Event Bus is used by Saga pattern?
Answer:
When we use event-based communication, a microservice publish an event when something notable happens such as when it updates a business entity. Other microservices subscribe to these events.
When a microservice receives an event, it can update it's own business entities which might lead to more events being published.
This publish/subscribe system is usually performed by using an implementation of an event bus.
The event bus is designed as an interface with the API needed to subscribe and unsubscribe to events and to publish events.
The implementation of this event bus can be a messaging queue like RabbitMQ or service bus like Azure service bus.
Question 4:
Explain ACID properties of database.
Answer :
A transaction is a single unit of work which accesses and possibly modifies the contents of a database. Transactions access data using read and write operations.
In order to maintain consistency in a database, before and after transaction, certain properties are followed. These are called ACID properties.
Atomicity:
By this, we mean that either the entire transaction takes place at once or doesn't happen at all.
Consistency:
This means that integrity constraints must be maintained so that the database is consistent before and after the transaction. It refers to the correctness of a database.
Isolation:
This property ensures that multiple transactions can occur concurrently without leading to inconsistency of database state. Transactions occur independently without interference.
Changes occuring in a particular transaction will not be visible to any other transaction until that particular change in that transaction is written to memory or has been committed.
Durability:
This property ensures that once the transaction has completed execution, the updates and modifications to the database are stored in and written to disk and they persist even if system failure occurs. The effects of the transaction , thus, are never lost.
Question 5:
What is difference between MVC and MVP architectures?
Answer:
MVC Architecture:
Model-View-Controller
MVP Architecture:
Model-View-Presenter
MVP is just like MVC , only difference is that Controller is replaced with Presenter.
View and Presenter are decoupled from each other using an interface. This interface is defined in Presenter .
View implements this interface and communicates with Presenter through this interface. Due to this loose coupling it is easy to mock View during unit testing.
That's all for this post.
Hope this post helps everyone in interviews.
Thanks for reading.
So, sharing all the interview questions asked in SirionLabs here.
Questions are mainly on Architectural designs.
You can also go through my other interview posts:
- Java 8 interview Questions - Part - I:
- Technical-architect-interview-in-incedo-2
- Java Interview @ Aricent - Part - 2
- Java Interview @ Gemini Solutions
- Java Interview @ OLX
- Java Interview @ SAP
- Java Interview @ GalaxE
- Java Interview @ OrangeMantra
- Java Interview @ Concirrus
- Java Interview @ NexGen Solutions
Question 1:
What is the difference between Saga and 2 Phase Commit patterns?
Answer:
Saga and 2 Phase Commit patterns are used for distributed transactions.
A distributed transaction would do what a transaction would do but on multiple databases.
Differences:
- 2 Phase Commit is for immediate transactions. Saga pattern is for long running transactions.
- In 2 Phase Commit, there is a single controlling node and if it goes down, then entire system fails. In Saga Pattern, There are multiple coordinators: Saga Execution Coordinator.
- 2 Phase Commit works in 2 steps: Prepare and Commit. And the result of all the transactions are seen to the outer world at once together. But in Saga, there is only one step for execution and commit, but if any transaction fails, then compensatory transaction gets executed for rollback operation.
Question 2:
Which database should be used when storing billions of payment requests come to database and why?
Answer:
In this case, data is relational in nature like payment amount, user id, payment date, payment location, account number etc.
So, I can easily use SQL Server 2016 with proper indexes on proper fields.
Question 3:
Which Event Bus is used by Saga pattern?
Answer:
When we use event-based communication, a microservice publish an event when something notable happens such as when it updates a business entity. Other microservices subscribe to these events.
When a microservice receives an event, it can update it's own business entities which might lead to more events being published.
This publish/subscribe system is usually performed by using an implementation of an event bus.
The event bus is designed as an interface with the API needed to subscribe and unsubscribe to events and to publish events.
The implementation of this event bus can be a messaging queue like RabbitMQ or service bus like Azure service bus.
Question 4:
Explain ACID properties of database.
Answer :
A transaction is a single unit of work which accesses and possibly modifies the contents of a database. Transactions access data using read and write operations.
In order to maintain consistency in a database, before and after transaction, certain properties are followed. These are called ACID properties.
Atomicity:
By this, we mean that either the entire transaction takes place at once or doesn't happen at all.
Consistency:
This means that integrity constraints must be maintained so that the database is consistent before and after the transaction. It refers to the correctness of a database.
Isolation:
This property ensures that multiple transactions can occur concurrently without leading to inconsistency of database state. Transactions occur independently without interference.
Changes occuring in a particular transaction will not be visible to any other transaction until that particular change in that transaction is written to memory or has been committed.
Durability:
This property ensures that once the transaction has completed execution, the updates and modifications to the database are stored in and written to disk and they persist even if system failure occurs. The effects of the transaction , thus, are never lost.
Question 5:
What is difference between MVC and MVP architectures?
Answer:
MVC Architecture:
Model-View-Controller
MVP Architecture:
Model-View-Presenter
MVP is just like MVC , only difference is that Controller is replaced with Presenter.
View and Presenter are decoupled from each other using an interface. This interface is defined in Presenter .
View implements this interface and communicates with Presenter through this interface. Due to this loose coupling it is easy to mock View during unit testing.
That's all for this post.
Hope this post helps everyone in interviews.
Thanks for reading.
No comments:
Post a Comment