Java Architect Interview Questions and Answers (2021) | TechGeekNext >>



Java Architect Interview Questions and Answers (2021)

  1. Q: What does SOLID stand for? What are its principles?
  2. Q: What is the difference between Monolithic, SOA and Microservices Architecture?
  3. Q: What are the differences between continuous integration, continuous delivery, and continuous deployment?
  4. Q: What is the difference between Concurrency and Parallelism?
  5. Q: What is Domain Driven Design?
  6. Q: Explain the Single Responsibility Principle (SRP)?
  7. Q: Do you familiar with The Twelve-Factor App principles?
  8. Q: What is MetaSpace in Java8? How does it differ from PermGen Space?
  9. Q: How Does Volatile Affect Code Optimization By Compiler?

Q: What is SOLID principles?
Ans:

S.O.L.I.D is an acronym for the first five principles of object-oriented design (OOD) by Robert C. Martin, which stands from

  1. S - Single-responsiblity principle : A class should have one reason to change, which means that a class should only have one job.
  2. O - Open-closed principle : Objects / entities should be open for extension, but closed for modification.
  3. L - Liskov substitution principle : Let q(x) be a property provable about objects of x of type T. Then q(y) should be provable for objects y of type S where S is a subtype of T.
  4. I - Interface segregation principle : A client should never be forced to implement an interface that it does not use, or clients should not be forced to rely on methods that they do not use.
  5. D - Dependency Inversion Principle : Entities must depend on abstractions, not concreteness. It states that the high-level module must not depend on the low-level module, but should depend on abstractions.

Q: What is the difference between Monolithic, SOA and Microservices Architecture?
Ans:

The aim of the LTS version is to complete the preview capabilities so that they are stable enough and look good for the next three years.
  1. Monolithic Architecture is analogous to a large container in which all software elements of the application are assembled together and wrapped tightly.
  2. Service-Oriented Architecture is a set of services that interact with each other. Communication may involve either simple transmission of data or may involve two or more services coordinating such activities.
  3. Microservice Architecture is an architectural style that constructs an application as a series of small autonomous services, modeled around a business domain.

Q: What is continuous integration, continuous delivery, and continuous deployment?
Ans:

Continuous Integration and continuous Delivery (CI/CD) is a set of software practices and techniques that enable the frequent release of small batches of code changes, with extensive visibility and traceability. It typically involves the creation of a largely automated pipeline that orchestrates the build, test and deployment of software across staged environments, ultimately leading to deployment in production.

  1. Continuous Integration : Developers merge their changes back to the main branch as much as possible, instead of waiting for the release day to integrate their changes into the release branch.
  2. Continuous delivery : is an extension of continuous integration to ensure that new improvements can be made easily and sustainably to the customers. This means that, in addition to getting your testing automated, you have also automated your release process and can deploy your application at any time by clicking on a button.
  3. Continuous delivery is one step beyond continuous delivery, with this any change that passes through all stages of your production pipeline is released to your customers. There is no human interference, and only a failed test can prevent a new improvement from being introduced to production.

Q: Do you familiar with The Twelve-Factor App principles?
Ans:

The 12-factor app approach is a technique for software development as a service. These best practices are intended to allow portability and resilience web applications to be developed.
  1. Codebase : Central one codebase for a deployed service tracked in revision control with the codebase being used for many deployments.
  2. Dependencies : Explicitly declare and isolate dependencies. All dependencies should be declared, with no implicit reliance on system tools or libraries.
  3. Config : Store config in the environment. Configuration that varies between deployments should be stored in the environment.
  4. Backing services : Treat backing services as attached resources. All backing services are treated as attached resources and attached and detached by the execution environment.
  5. Build, release, run : Strictly separate build and run stages. The delivery pipeline should strictly consist of build, release, run.
  6. Port binding : Export services as port binding. Self-contained services should make themselves available to other services by specified ports.
  7. Concurrency : Scale out via the process model. Concurrency is advocated by scaling individual processes.
  8. Dev/Prod parity : Keep development, staging and production as similar as possible. All environments should be as similar as possible.
  9. Logs : Treat log as event stream. Applications should produce logs as event streams and leave the execution environment to aggregate.
  10. Admin Processes : Run admin/management tasks as one-off process. Any needed admin tasks should be kept in source control and packaged with the application.

Q: What was enhanced for Z Garbage Collector (ZGC)?
Ans:

JDK 11 has introduced Z Garbage Collector (ZGC), which had short pause while cleaning up the heap memories and it was not returning unused memory to operating system even though memory was unused for long time. Now Java 13 has extended the feature to return unused heap memory to the operating system.

Click on link to know more about Z Garbage Collector

Q: What is Domain Driven Design?
Ans:

Domain driven design is a methodology and process prescription for developing complex systems which focus on mapping into the technical objects of a solution area activities, tasks, events and data within a problem field. It's all about making your software a real system or process model.

Take a look at our suggested post on Java :

Q: When should I use a NoSQL database instead of a relational database?
Ans:

Relational databases enforce the ACID. So, you can have schema-based data stores that are transaction-oriented. For 99 percent of real world applications, it is proven and suitable. With relational databases, you can basically do anything.

when it comes to large high-availability data stores, there are speed and scaling limitations. Google and Amazon have terabytes of data stored in large data centers, for example. In these cases, querying and inserting is not successful because of the blocking/schema/transaction nature of the RDBMs.

That is why, for huge performance benefit and scalability, they have introduced their own databases (actually, key-value stores).

    We use NoSQL db usually when:
  • Client requires 99.999 percent availability at high traffic sites.
  • Your data doesn't make any sense in SQL, you find yourself doing multiple JOIN queries to access some piece of information.
  • you split the relational model, have CLOBs that store denormalized data, and create external indexes to search for that data.

Q: What is Permgen (Permanent Generation) ?
Ans:

A memory pool that contains all of the Java Virtual Machine's own reflective data, such as class and method objects. With Java VMs that use data sharing class, this generation is divided into read-only and read-write areas.

Permanent Generation contains the metadata needed by the JVM for the application to define the classes and methods used. At runtime, the permanent generation is populated by the JVM based on classes in the application's use. Moreover, the classes and methods of the Java SE library can be stored here.

Q: What is MetaSpace in Java8? How does it differ from PermGen Space?
Ans:

The Permanent Generation (PermGen) space has been removed completely with JDK8 and is kind of replaced by a new space called Metaspace.

This metadata is now stored as "MetaSpace" in the native memory. This memory is not a Java Heap contiguous memory. It allows for improvements in the collection of garbage space over PermGen space, auto tuning, concurrent metadata de-allocation.

The result of the PermGen elimination is that the PermSize and MaxPermSize JVM arguments are obviously ignored and you will never receive an error with java.lang.OutOfMemoryError: PermGen.

Q: How Does Volatile Affect Code Optimization By Compiler?
Ans:

Volatile is an instruction that multiple threads will access the variables and should therefore not be cached. Because volatile variables are never cached, their retrieval can therefore not be optimized.
























Recommendation for Top Popular Post :