Mphasis
30+ H2A Architect Interview Questions and Answers
How can you create a Singleton class in Java?
What are the main return types supported in Web API?
What is different between REST API and RESTful API?
When can a Factory Pattern be used ?
What is static and Dynamic Binding?
What do you mean by SQL injection attack?
Q8. What is runtime polymorphism and how do you achieve it?
Runtime polymorphism is the ability of an object to take on multiple forms during runtime.
It is achieved through inheritance and method overriding.
The method called depends on the actual object type at runtime.
Example: Animal class with a speak() method, and Dog and Cat classes that inherit from Animal and override the speak() method.
When a Dog object calls speak(), the overridden method in the Dog class is executed.
When a Cat object calls speak(), the overridden method in th...read more
SQL Query to fetch first 5 characters of a string
Q11. What is dependency injection and what are the benefits?
Dependency injection is a design pattern where objects are passed as dependencies rather than being created within a class.
Reduces coupling between classes
Increases testability and maintainability
Allows for easier swapping of dependencies
Examples: Constructor injection, Setter injection, Interface injection
Q12. What is Indexing in SQL and why do we use Indexing?
Indexing in SQL is a way to optimize database performance by creating a data structure that allows for faster retrieval of data.
Indexing is a technique used to quickly locate and access the rows in a database table.
It works by creating an ordered list of values from one or more columns in a table.
By using indexes, the database engine can quickly find the rows that match a certain condition without having to scan the entire table.
Indexes are especially useful for tables with a...read more
Q13. Entity framework to join and pull details from joinee table. Left/Right join in Entity framework
Entity framework supports left/right join to pull details from joinee table.
Use LINQ to perform left/right join in Entity framework
Use DefaultIfEmpty() method to perform left join
Use join...into statement to perform right join
Example: var result = from employee in context.Employees
join department in context.Departments on employee.DepartmentId equals department.Id into empDept
from department in empDept.DefaultIfEmpty() select new { employee.Name, department.Name }
Difference between Clustered and Non-Clustered Index
Q15. Have you ever worked with nUnit framework?
Yes, I have worked with nUnit framework.
I have used nUnit for unit testing in C# projects.
I am familiar with its syntax and assertions.
I have integrated nUnit with Visual Studio for continuous testing.
I have used nUnit to test both simple and complex scenarios.
For example, I used nUnit to test a payment processing system.
I also used nUnit to test a complex algorithm for data analysis.
Difference between Abstract class and Interface
Explain the lifecycle methods of components.
Q18. What are the endpoints in WebAPI
Endpoints are URLs that clients use to access resources in a WebAPI.
Endpoints are the entry points for a WebAPI.
They define the resources that can be accessed by clients.
Endpoints are identified by a URL and HTTP method.
Examples of endpoints include /api/users and /api/products.
Endpoints can have parameters that are passed in the URL or request body.
Q19. If we have partitions in Databases why we need partition in informatica also??
Partitions in Informatica help in parallel processing and improving performance.
Partitions in databases and Informatica serve different purposes
Informatica partitions help in parallel processing of data
Improves performance by distributing data processing across multiple nodes
Allows for better resource utilization and faster data processing
Example: Partitioning in Informatica can be used to process large volumes of data efficiently
Q20. Various patterns to achieve DI (Method, Constructor, Property level)
DI can be achieved through method, constructor, and property level patterns.
Method level DI involves passing dependencies as method parameters.
Constructor level DI involves passing dependencies as constructor parameters.
Property level DI involves setting dependencies as properties of an object.
Examples of DI frameworks that use these patterns include Spring and Unity.
Choosing the appropriate pattern depends on the specific use case and design considerations.
Q21. What are the various joins in SQL?
Various types of joins in SQL include inner join, left join, right join, and full outer join.
Inner join: Returns rows when there is a match in both tables.
Left join: Returns all rows from the left table and the matched rows from the right table.
Right join: Returns all rows from the right table and the matched rows from the left table.
Full outer join: Returns rows when there is a match in either table.
Q22. What is Liskov Principle?
Liskov Principle is a principle of object-oriented programming that states that objects of a superclass should be replaceable with objects of its subclasses without affecting the correctness of the program.
Named after Barbara Liskov, a computer scientist who introduced the principle in 1987
Also known as Liskov Substitution Principle (LSP)
Helps in designing classes that are easy to extend and maintain
Violation of LSP can lead to unexpected behavior in the program
Example: If a ...read more
Q23. Explain the difference b/w WebService vs WebApi
WebService is a software system designed to support interoperable machine-to-machine interaction over a network. WebApi is a framework for building HTTP services that can be consumed by a broad range of clients.
WebService uses SOAP protocol for communication while WebApi uses HTTP protocol.
WebService is platform-independent while WebApi is platform-dependent.
WebService supports only XML format while WebApi supports XML, JSON, and other formats.
WebService is used for enterpris...read more
Q24. Select alternate rows from SQL
Select alternate rows from SQL
Use the modulo operator to filter alternate rows
Add a WHERE clause with the modulo operator
Example: SELECT * FROM table WHERE id % 2 = 0
Example: SELECT * FROM table WHERE MOD(id, 2) = 0
Q25. Interconnect between microservices
Interconnect between microservices involves communication protocols, service discovery, load balancing, and fault tolerance.
Use communication protocols like HTTP, gRPC, or messaging queues for inter-service communication
Implement service discovery mechanisms to locate and connect to other microservices dynamically
Utilize load balancing techniques to distribute incoming requests evenly across multiple instances of a service
Implement fault tolerance strategies such as circuit b...read more
Q26. Clustered Index vs Non-clustered Index
Clustered index determines physical order of data while non-clustered index has separate structure.
Clustered index determines the physical order of data in a table while non-clustered index has a separate structure.
Clustered index is faster for retrieval of data while non-clustered index is faster for retrieval of specific data.
A table can have only one clustered index while multiple non-clustered indexes can be created.
Clustered index is created on the primary key by default...read more
Q27. What is a recursive query?
A recursive query is a query that refers to itself in order to retrieve data from a database.
A recursive query is used to retrieve hierarchical data such as organizational structures or family trees.
It typically involves a common table expression (CTE) in SQL.
The query continues to execute until a specific condition is met, such as reaching the root node in a tree structure.
Example: Finding all employees and their managers in a company hierarchy.
Q28. Port change in spring boot
To change the port in Spring Boot, modify the application.properties file or use command line arguments.
Modify application.properties file with 'server.port=XXXX'
Use command line argument '--server.port=XXXX'
Update port in embedded server configuration in code
Q29. sql query for update
SQL query for updating data in a database table.
Use the UPDATE statement in SQL to modify existing records in a table.
Specify the table name, column names, and values to be updated in the query.
Use WHERE clause to specify the condition for which records to update.
Example: UPDATE table_name SET column1 = value1, column2 = value2 WHERE condition;
Q30. Explain Factory Design Pattern
Factory Design Pattern is a creational pattern that provides an interface for creating objects in a superclass, but allows subclasses to alter the type of objects that will be created.
Factory Design Pattern is used to create objects without exposing the creation logic to the client.
It provides a way to delegate the instantiation logic to child classes.
It promotes loose coupling by eliminating the need to bind application-specific classes into the code.
Examples include: Simple...read more
Q31. WAP to to find the palindrome of string
A program to find if a given string is a palindrome or not.
Create a function that takes a string as input
Reverse the string and compare it with the original string
If they are the same, then the string is a palindrome
Q32. Internal working of Hashmap, linkedlist
Hashmap uses hashing to store key-value pairs, while linkedlist is a data structure used to store a collection of elements.
Hashmap uses a hash function to map keys to indices in an array, where the values are stored.
Linkedlist is a collection of nodes, where each node contains a value and a reference to the next node.
Hashmap can have collisions, where multiple keys map to the same index, which is resolved using separate chaining or open addressing.
Linkedlist can be singly lin...read more
Q33. Singleton vs static
Singleton and static are both design patterns used to create objects with global access, but they differ in their implementation.
Singleton restricts the instantiation of a class to a single object, while static allows multiple instances.
Singleton provides a global point of access to the object, while static members are accessed through the class name.
Singleton can be lazy-loaded, while static members are initialized at compile-time.
Singleton can be used to maintain state acro...read more
Q34. Junit testing for rest services
Junit testing for rest services involves testing the functionality and performance of RESTful APIs using Junit framework.
Write test cases to validate the input and output of REST services
Use Junit annotations like @Test, @Before, @After for setup and teardown
Mock external dependencies using frameworks like Mockito for isolated testing
Verify HTTP status codes, response body, headers in test cases
Use tools like RestAssured for making HTTP requests and validating responses
Q35. system design and design principles
System design involves creating a high-level architecture of a software system based on requirements and design principles.
System design focuses on structuring software components and their interactions.
Design principles like SOLID, DRY, and KISS help in creating scalable and maintainable systems.
Consider factors like performance, scalability, security, and maintainability during system design.
Use design patterns like MVC, Observer, and Factory to solve common design problems...read more
Q36. Explain framework
A framework is a set of rules, guidelines, and standards that provide a structure for developing software applications.
A framework provides a foundation for building software applications
It includes pre-written code and libraries that can be reused
Frameworks can be used to speed up development time and improve code quality
Examples of popular frameworks include React, Angular, and Django
Interview Process at H2A Architect
Top Module Lead Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month