John David

John David

1558662911

Best Java Microservices Interview Questions In 2019

Top Microservices Interview Questions

According to Gartner, **microservices **are the new application platform for cloud development. **Microservices **are deployed and managed independently, and once implemented inside containers they have very little interaction with the underlying OS. So, if you are planning to start your career in the **Microservices **and you wish to know the skills related to it, now is the right time to dive in, when the technology is in its nascent state.

In case you have attended any **Microservices interview **in the recent past, do paste those interview questions in the comments section and we’ll answer them ASAP. You can also comment below if you have any **questions **in your mind, which you might face in your Microservices interview.

You may go through this recording of Microservices Interview Questions and **Answers **where our instructor has explained the topics in a detailed manner with examples that will help you to **understand **this concept better.

Q1. List down the advantages of Java Microservices Architecture.

Q2. What do you know about Microservices?

Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modeled around a **business domain.**In layman terms, you must have seen how bees build their honeycomb by aligning hexagonal wax cells.They initially start with a small section using various materials and continue to build a large beehive out of it.These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive.Here, each cell is independent of the other but it is also correlated with the other cells.This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.

Fig 1: Beehive Representation of Microservices – Microservices Interview Questions

Refer to the above diagram. Here, each hexagonal shape represents an individual service component. Similar to the working of bees, each agile team builds an individual service component with the available frameworks and the chosen technology stack. Just as in a beehive, each service component forms a strong microservice architecture to provide better scalability. Also, issues with each service component can be handled individually by the agile team with no or minimal impact on the entire application.

Q3. What are the features of Microservices?

Fig 3: Features of Microservices – Microservices Interview Questions
Decoupling – Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled
Componentization
– Microservices are treated as independent components that can be easily replaced and upgradedBusiness Capabilities – Microservices are very simple and focus on a single capabilityAutonomy – Developers and teams can work independently of each other, thus increasing speedContinous Delivery – Allows frequent releases of software, through systematic automation of software creation, testing, and approvalResponsibility – Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsibleDecentralized Governance – The focus is on using the right tool for the right job. That means there is no standardized pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problemsAgility – Microservices support agile development. Any new feature can be quickly developed and discarded again## Q4. What are the best practices to design Microservices?

The following are the best practices to design microservices:

**Fig 4: **Best Practices to Design Microservices – Microservices Interview Questions

Q5. How does Microservice Architecture work?

A microservice architecture has the following components:

**Fig 5: **Architecture of Microservices – Microservices Interview Questions
Clients – Different users from various devices send requests.Identity Providers – Authenticates user or clients identities and issues security tokens.API Gateway – Handles client requests.Static Content – Houses all the content of the system.Management – Balances services on nodes and identifies failures.Service Discovery – A guide to find the route of communication between microservices.Content Delivery Networks – Distributed network of proxy servers and their data centers.Remote Service – Enables the remote access information that resides on a network of IT devices.## Q6. What are the pros and cons of Microservice Architecture?

Q7. What is the difference between Monolithic, SOA and Microservices Architecture?

**Fig 6: **Comparison Between Monolithic SOA & Microservices – Microservices Interview Questions
Monolithic Architecture is similar to a big container wherein all the software components of an application are assembled together and tightly packaged.A Service-Oriented Architecture is a collection of services which communicate with each other. The communication can involve either simple data passing or it could involve two or more services coordinating some activity.Microservice Architecture is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain.## Q8. What are the challenges you face while working Microservice Architectures?

Developing a number of smaller microservices sounds easy, but the challenges often faced while developing them are as follows.
Automate the Components: Difficult to automate because there are a number of smaller components. So for each component, we have to follow the stages of Build, Deploy and, Monitor.Perceptibility: Maintaining a large number of components together becomes difficult to deploy, maintain, monitor and identify problems. It requires great perceptibility around all the components.Configuration Management: Maintaining the configurations for the components across the various environments becomes tough sometimes.Debugging: Difficult to find out each and every service for an error. It is essential to maintain centralized logging and dashboards to debug problems.## Q9. What are the key differences between SOA and Microservices Architecture?

The key differences between SOA and microservices are as follows:

Q10. What are the characteristics of Microservices?

You can list down the characteristics of microservices as follows:

**Fig 7: **Characteristics of Microservices – Microservices Interview Questions

Q11. What is Domain Driven Design?

**Fig 8: **Principles of DDD – Microservices Interview Questions

Q12. Why there is a need for Domain Driven Design (DDD)?

**Fig 9: **Factors Why we need DDD – Microservices Interview Questions

Q13. What is Ubiquitous language?

If you have to define the** Ubiquitous Language (UL)**, then it is a common language used by developers and users of a specific domain through which the domain can be explained easily.

The ubiquitous language has to be crystal clear so that it brings all the team members on the same page and also translates in such a way that a machine can understand.

Q14. What is Cohesion?

The degree to which the elements inside a module belong together is said to be cohesion.

Q15. What is Coupling?

The measure of the strength of the dependencies between components is said to be coupling. A good design is always said to have High Cohesion and** Low Coupling**.

Q16. What is REST/RESTful and what are its uses?

Representational State Transfer (REST)/RESTful web services are an architectural style to help computer systems communicate over the internet. This makes microservices easier to understand and implement.

Microservices can be implemented with or without RESTful APIs, but it’s always easier to build loosely coupled microservices using RESTful APIs.

Q17. What do you know about Spring Boot?

It’s a knows fact that spring has become more and more complex as new functionalities have been added. If you have to start a new spring project, then you have to add build path or add maven dependencies, configure application server, add spring configuration. So everything has to be done from scratch.

Spring Boot is the solution to this problem. Using spring boot you can avoid all the boilerplate code and configurations. So basically consider yourself as if you’re baking a cake spring is like the ingredients that are required to make the cake and spring boot is the complete cake in your hand.

**Fig 10: **Factors of Spring Boot – Microservices Interview Questions

Q18. What is an actuator in Spring boot?

Spring Boot actuator provides restful web services to access the current state of running an application in the production environment. With the help of actuator, you can check various metrics and monitor your application.

Q19. What is Spring Cloud?

According to the official website of Spring Cloud, Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, leadership election, distributed sessions, cluster state).

Q20. What problems are solved by Spring Cloud?

While developing distributed microservices with Spring Boot we face few issues which are solved by Spring Cloud.
**The complexity associated with distributed systems – **This includes network issues, Latency overhead, Bandwidth issues, security issues.**Ability to handle Service Discovery – **Service discovery allows processes and services in a cluster to find each other and communicate.**Solved redundancy issues – **Redundancy issues often occur in distributed systems.**Load balancing – **Improves the distribution of workloads across multiple computing resources, such as a computer cluster, network links, central processing units.**Reduces performance issues – **Reduces performance issues due to various operational overheads.## Q21. What is the use of WebMvcTest annotation in Spring MVC applications?

WebMvcTest annotation is used for unit testing Spring MVC Applications in cases where the test objective is to just focus on Spring MVC Components. In the snapshot shown above, we want to launch only the ToTestController. All other controllers and mappings will not be launched when this unit test is executed.

Q22. Can you give a gist about Rest and Microservices?

REST

Though you can implement microservices in multiple ways, REST over HTTP is a way to implement Microservices. REST is also used in other applications such as web apps, API design, and MVC applications to serve business data.

Microservices

Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually. There are certain principles and best practices of Microservices that help in building a resilient application.

In a nutshell, you can say that REST is a medium to build Microservices.

Q23. What are different types of Tests for Microservices?

While working with microservices, testing becomes quite complex as there are multiple microservices working together. So, tests are divided into different levels.
At the bottom level, we have technology-facing tests like- unit tests and performance tests. These are completely automated.At the middle level, we have tests for exploratory testing like the stress tests and usability tests.At the **top level, **we have acceptance tests that are few in number. These acceptance tests help stakeholders in understanding and verifying software features.## Q24. What do you understand by Distributed Transaction?

Distributed Transaction is any situation where a single event results in the mutation of two or more separate sources of data which cannot be committed atomically. In the world of microservices, it becomes even more complex as each service is a unit of work and most of the time multiple services have to work together to make a business successful.

Q25. What is an Idempotence and where it is used?

Idempotence is the property of being able to do something twice in such a way that the end result will remain the same i.e. as if it had been done once only.

Usage: Idempotence is used at the remote service, or data source so that, when it receives the instruction more than once, it only processes the instruction once.

Q26. What is Bounded Context?

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD’s strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their inter-relationships.

Q27. What is Two Factor Authentication?

Two-factor authentication enables the second level of authentication to an account log-in process.

**Fig11: **Representation of Two Factor Authentication – Microservices Interview Questions

So suppose a user has to enter only username and password, then that’s considered a single-factor authentication.

Q28. What are the types of credentials of Two Factor Authentication?

The three types of credentials are:

**Fig 12: **Types of Credentials of Two Factor Authentication – Microservices Interview Questions

Q29. What are Client certificates?

A type of digital certificate that is used by client systems to make authenticated requests to a remote server is known as the** client certificate**. Client certificates play a very important role in many mutual authentication designs, providing strong assurances of a requester’s identity.

Q30. What is the use of PACT in Microservices architecture?

**PACT **is an open source tool to allow testing interactions between service providers and consumers in isolation against the contract made so that the reliability of Microservices integration increases.

Usage in Microservices:

Used to implement Consumer Driven Contract in Microservices.Tests the consumer-driven contracts between consumer and provider of a Microservice.## Q31. What is OAuth?

**OAuth **stands for open authorization protocol. This allows accessing the resources of the resource owner by enabling the client applications on HTTP services such as third-party providers Facebook, GitHub, etc. So with this, you can share resources stored on one site with another site without using their credentials.

Q32. What is Conway’s law?

“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.” –*** Mel Conway***

**Fig 13: **Representation of Conway’s Law – Microservices Interview Questions

This law basically tries to convey the fact that, in order for a software module to function, the complete team should communicate well. Therefore the structure of a system reflects the social boundaries of the organization(s) that produced it.

Q33. What do you understand by Contract Testing?

According to Martin Flower,** contract test **is a test at the boundary of an external service which verifies that it meets the contract expected by a consuming service.

Also, contract testing does not test the behavior of the service in depth. Rather, it tests that the inputs & outputs of service calls contain required attributes and the response latency, throughput is within allowed limits.

Q34. What is End to End Microservices Testing?

End-to-end testing validates each and every process in the workflow is functioning properly. This ensures that the system works together as a whole and satisfies all requirements.

In layman terms, you can say that end to end testing is a kind of tests where everything is tested after a particular period.

**Fig 14: **Hierarchy of Tests – Microservices Interview Questions

Q35. What is the use of Container in Microservices?

Containers are a good way to manage microservice based application to develop and deploy them individually*.* You can encapsulate your microservice in a container image along with its dependencies, which then can be used to roll on-demand instances of microservice without any additional efforts required.

**Fig 15: **Representation of Containers and How they are used in Microservices – Microservices Interview Questions

Q36. What is DRY in Microservices architecture?

DRY stands for Don’t Repeat Yourself. It basically promotes the concept of reusing the code. This results in developing and sharing the libraries which in turn result in tight coupling.

Q37. What is a Consumer-Driven Contract (CDC)?

This is basically a pattern for developing Microservices so that they can be used by external systems. When we work on microservices, there is a particular provider who builds it and there are one or more consumers who use Microservice.

Generally, providers specify the interfaces in an XML document. But in Consumer Driven Contract, each consumer of service conveys the interface expected from the Provider.

Q38. What is the role of Web, RESTful APIs in Microservices?

A microservice architecture is based on a concept wherein all its services should be able to interact with each other to build a business functionality. So, to achieve this, each microservice must have an interface. This makes the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of a microservice architecture.

Q39. What do you understand by Semantic monitoring in Microservices architecture?

Semantic monitoring, also known as** synthetic monitoring** combines automated tests with monitoring the application in order to detect business failing factors.

Q40. How can we perform Cross-Functional testing?

Cross-functional testing is a verification of non-functional requirements, i.e. those requirements which cannot be implemented like a normal feature.

Q41. How can we eradicate non-determinism in tests?

Non-Deterministic Tests (NDT) are basically unreliable tests. So, sometimes it may happen that they pass and obviously sometimes they may also fail. As and when they fail, they are made to re-run to pass.

Some ways to remove non-determinism from tests are as follows:
QuarantineAsynchronousRemote ServicesIsolationTimeResource leaks## Q42. What is the difference between Mock or Stub?

Stub

A dummy object that helps in running the test.Provides fixed behavior under certain conditions which can be hard-coded.Any other behavior of the stub is never tested.
For example, for an empty stack, you can create a stub that just returns true for empty() method. So, this does not care whether there is an element in the stack or not.

Mock

A dummy object in which certain properties are set initially.The behavior of this object depends on the set properties.The object’s behavior can also be tested.
For example, for a Customer object, you can mock it by setting name and age. You can set age as 12 and then test for isAdult() method that will return true for age greater than 18. So, your Mock Customer object works for the specified condition.

Q43. What do you know about Mike Cohn’s Test Pyramid?

Mike Cohn provided a model called Test Pyramid. This describes the kind of automated tests required for software development.

**Fig 16: **Mike Cohn’s Test Pyramid – Microservices Interview Questions

As per pyramid, the number of tests at first layer should be highest. At service layer, the number of tests should be less than at the unit test level, but more than at the end-to-end level.

Q44. What is the purpose of Docker?

Docker provides a container environment that can be used to host any application. In this, the software application and the dependencies which support it are tightly-packaged together.

So, this packaged product is called a Container and since it is done by Docker, it is called Docker container!

Q45. What is Canary Releasing?

Canary Releasing is a technique to reduce the risk of introducing a new software version in production. This is done by slowly rolling out the change to a small subset of users before giving it out to the entire infrastructure, i.e. making it available to everybody.

Q46. What do you mean by Continuous Integration (CI)?

Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. This encourages developers to share code and unit tests by merging the changes into a shared version control repository after every small task completion.

Q47. What is Continuous Monitoring?

**Continuous monitoring **gets into the depth of monitoring coverage, from in-browser front-end performance metrics, through application performance, and down to host virtualized infrastructure metrics.

Q48. What is the role of an architect in Microservices architecture?

An architect in microservices architecture plays the following roles:
Decides broad strokes about the layout of the overall software system.Helps in deciding the zoning of the components. So, they make sure components are mutually cohesive, but not tightly coupled.Code with developers and learn the challenges faced in day-to-day life.Make recommendations for certain tools and technologies to the team developing microservices.Provide technical governance so that the teams in their technical development follow principles of Microservice.## Q49. Can we create State Machines out of Microservices?

As we know that each Microservice owning its own database is an independently deployable program unit, this, in turn, lets us create a State Machine out of it. So, we can specify different states and events for a particular microservice.

For Example, we can define an Order microservice. An Order can have different states. The transitions of Order states can be independent events in the Order microservice.

Q50. What are Reactive Extensions in Microservices?

Reactive Extensions also are known as Rx. It is a design approach in which we collect results by calling multiple services and then compile a combined response. These calls can be synchronous or asynchronous, blocking or non-blocking. Rx is a very popular tool in distributed systems which works opposite to legacy flows.

Hope these Microservices Interview Questions would help you in your Microservices Architect Interviews.

#java #spring-boot #interview #interview-questions

What is GEEK

Buddha Community

Best Java Microservices Interview Questions In 2019

Top 130 Android Interview Questions - Crack Technical Interview Now!

Android Interview Questions and Answers from Beginner to Advanced level

DataFlair is committed to provide you all the resources to make you an android professional. We started with android tutorials along with practicals, then we published Real-time android projects along with source code. Now, we come up with frequently asked android interview questions, which will help you in showing expertise in your next interview.

android interview questions

Android Interview Questions – Get ready for your next interview

Android – one of the hottest technologies, which is having a bright future. Get ready to crack your next interview with the following android interview questions. These interview questions start with basic and cover deep concepts along with advanced topics.

Android Interview Questions for Freshers

1. What is Android?

Android is an open-source mobile operating system that is based on the modified versions of Linux kernel. Though it was mainly designed for smartphones, now it is being used for Tablets, Televisions, Smartwatches, and other Android wearables.

2. Who is the inventor of Android Technology?

The inventors of Android Technology are- Andry Rubin, Nick Sears, and Rich Miner.

3. What is the latest version of Android?

The latest version of Android is Android 10.0, known as Android Q. The upcoming major Android release is Android 11, which is the 18th version of Android. [Note: Keep checking the versions, it is as of June 2020.]

4. How many Android versions can you recall right now?

Till now, there are 17 versions of Android, which have their names in alphabetical order. The 18th version of Android is also going to come later this year. The versions of Android are here:

  • Android 1.0 – Its release is 23 September 2008.
  • Android 1.1 – Its release date is 9 February 2009.
  • Android 1.5 – Its name is Cupcake, Released on 27 April 2009.
  • Android 1.6 – Its name is Donut, Released on 15 September 2009.
  • Android 2.0 – Its name is Eclair, Released on 26 October 2009
  • Android 2.2 – Its name is Froyo, Released on 20 May 2010.
  • Android 2.3 – Its name is Gingerbread, Released on 06 December 2010.
  • Android 3.0 – Its name is Honeycomb, Released on 22 February 2011.
  • Android 4.0 – Its name is Ice Cream Sandwich, Released on 18 October 2011.
  • Android 4.1 – Its name is Jelly Bean, Released on 9 July 2012.
  • Android 4.4 – Its name is KitKat, Released on 31 October 2013.
  • Android 5.0 – Its name is Lollipop, Released on 12 November 2014.
  • Android 6.0 – Its name is Marshmallow, Released on 5 October 2015.
  • Android 7.0 – Its name is Nougat, Released on 22 August 2016.
  • Android 8.0 – Its name is Oreo, Released on 21 August 2017.
  • Android 9.0 – Its name is Pie, Released on 6 August 2018.
  • Android 10.0 – Its name is Android Q, Released on 3 September 2019.
  • Android 11.0 – As of now, it is Android 11.

5. Explain the Android Architecture with its components.

This is a popular android developer interview question

Android Architecture consists of 5 components that are-

a. Linux Kernel: It is the foundation of the Android Architecture that resides at the lowest level. It provides the level of abstraction for hardware devices and upper layer components. Linux Kernel also provides various important hardware drivers that act as software interfaces for hardwares like camera, bluetooth, etc.

b. Native Libraries: These are the libraries for Android that are written in C/C++. These libraries are useful to build many core services like ART and HAL. It provides support for core features.

c. Android Runtime: It is an Android Runtime Environment. Android Operating System uses it during the execution of the app. It performs the translation of the application bytecode into the native instructions. The runtime environment of the device then executes these native instructions.

d. Application Framework: Application Framework provides many java classes and interfaces for app development. And it also provides various high-level services. This complete Application framework makes use of Java.

e. Applications: This is the topmost layer of Android Architecture. It provides applications for the end-user, so they can use the android device and compute the tasks.

6. What are the services that the Application framework provides?

The Android application framework has the following key services-

a. Activity Manager: It uses testing and debugging methods.

b. Content provider: It provides the data from application to other layers.

c. Resource Manager: This provides users access to resources.

d. Notification Manager: This gives notification to the users regarding actions taking place in the background.

e. View System: It is the base class for widgets, and it is also responsible for event handling.

7. What are the important features of Linux Kernel?

The important features of the Linux Kernel are as follows:

a. Power Management: Linux Kernel does power management to enhance and improve the battery life of the device.

b. Memory Management: It is useful for the maximum utilization of the available memory of the device.

c. Device Management: It includes managing all the hardware device drivers. It maximizes the utilization of the available resources.

d. Security: It ensures that no application has any such permission that it affects any other application in order to maintain security.

e. Multi-tasking: Multi-tasking provides the users the ease of doing multiple tasks at the same time.

8. What are the building blocks of an Android Application?

This is a popular android interview question for freshers.

The main components of any Android application are- Activity, Services, Content Provider, and Broadcast Receiver. You can understand them as follows:

a. Activity- It is a class that acts as the entry point representing a single screen to the user. It is like a window to show the user interface.

b. Services- Services are the longest-running component that runs in the background.

c. Content Provider- The content provider is an essential component that allows apps to share data between themselves.

d. Broadcast receivers- Broadcast receiver is another most crucial application component. It helps the apps to receive and respond to broadcast messages from the system or some other application.

9. What are the important components of Android Application?

The Components of Android application are listed below:

  1. Widgets
  2. Intents
  3. Views
  4. Notification
  5. Fragments
  6. Layout XML files
  7. Resources

10. What are the widgets?

Widgets are the variations of Broadcast receivers. They are an important part of home screen customization. They often display some data and also allow users to perform actions on them. Mostly they display the app icon on the screen.

11. Can you name some types of widgets?

Mentioned below are the types of widgets-

a. Informative Widgets: These widgets show some important information. Like, the clock widget or a weather widget.

b. Collective Widgets: They are the collection of some types of elements. For example, a music widget that lets us change, skip, or forward the song.

c. Control Widgets: These widgets help us control the actions within the application through it. Like an email widget that helps check the recent mails.

d. Hybrid Widgets: Hybrid widgets are those that consist of at least two or more types of widgets.

12. What are Intents?

Intents are an important part of Android Applications. They enable communication between components of the same application as well as separate applications. The Intent signals the Android system about a certain event that has occurred.

13. Explain the types of intents briefly?

Intent is of three types that are-

a. Implicit Intents: Implicit intents are those in which there is no description of the component name but only the action.

b. Explicit Intents: In explicit intents, the target component is present by declaring the name of the component.

c. Pending Intents: These are those intents that act as a shield over the Intent objects. It covers the intent objects and grants permission to the external app components to access them.

14. What is a View?

A view is an important building block that helps in designing the user interface of the application. It can be a rectangular box or a circular shape, for example, Text View, Edit Text, Buttons, etc. Views occupy a certain area of the screen, and it is also responsible for event handling. A view is the superclass of all the graphical user interface components.

15. What do you understand by View Group?

It is the subclass of the ViewClass. It gives an invisible container to hold layouts or views. You can understand view groups as special views that are capable of holding other views, that are Child View.

16. What do you understand about Shared Preferences?

It is a simple mechanism for data storage in Android. In this, there is no need to create files, and using APIs, it stores the data in XML files. It stores the data in the pair of key-values. SharedPreferences class lets the user save the values and retrieve them when required. Using SharedPreferences we can save primitive data like- boolean, float, integer, string and long.

17. What is a Notification?

A notification is just like a message that shows up outside the Application UI to provide reminders to the users. They remind the user about a message received, or some other timely information from the app.

18. Give names of Notification types.

There are three types of notifications namely-

a. Toast Notification- This notification is the one that fades away sometime after it pops up.

b. Status Notification- This notification stays till the user takes some action on it.

c. Dialog Notification- This notification is the result of an Active Activity.

19. What are fragments?

A fragment is a part of the complete user interface. These are present in Activity, and an activity can have one or more fragments at the same time. We can reuse a fragment in multiple activities as well.

20. What are the types of fragments?

There are three types of fragments that are: Single Fragment, List Fragment, Fragment Transactions.

  1. Single Transactions can only show a single view for the user.
  2. List Fragments have a special list view feature that provides a list from which the user can select one.
  3. Fragment Transactions are helpful for the transition between one fragment to the other.

Frequently asked Android Interview Questions and Answers

21. What are Layout XML files?

Layout XML files contain the structure for the user interface of the application. The XML file also contains various different layouts and views, and they also specify various GUI components that are there in Activity or fragments.

22. What are Resources in Android Application?

The resources in Android Apps defines images, texts, strings, colors, etc. Everything in resources directory is referenced in the source code of the app so that we can use them.

23. Can you develop Android Apps with languages other than Java? If so, name some.

Yes, there are many languages that we can work with, for the development of Android Applications. To name some, I would say Java, Python, C, C++, Kotlin, C#, Corona/LUA.

24. What are the states of the Activity Lifecycle?

Activity lifecycle has the following four stages-

a. Running State: As soon as the activity starts, it is the first state.

b. Paused State: When some other activity starts without closing the previous one, the running activity turns into the Paused state.

c. Resume State: When the activity opens again after being in pause state, it comes into the Resume State.

d. Stopped State: When the user closes the application or stops using it, the activity goes to the Stopped state.

25. What are some methods of Activity?

The methods of Activity are as follows:

  • onCreate()
  • onStart()
  • onPause()
  • onRestart()
  • onResume()
  • onStop()
  • onDestroy()

26. How can you launch an activity in Android?

We launch an activity using Intents. For this we need to use intent as follows:

  1. ntent intent_name= new Intent(this, Activity_name.class);
  2. startActivity(intent_name);

27. What is the service lifecycle?

There are two states of a service that are-

a. Started State: This is when the service starts its execution. A Services come in start state only through the startService() method.

b. Bounded State: A service is in the bounded state when it calls the method bindService().

28. What are some methods of Services?

The methods of service are as follows-

  • onStartCommand()
  • onBind()
  • onCreate()
  • onUnbind()
  • onDestroy()
  • onRebind()

29. What are the types of Broadcast?

Broadcasts are of two types that are-

a. Ordered Broadcast: Ordered broadcasts are Synchronous and work in a proper order. It decides the order by using the priority assigned to the broadcasts.

b. Normal Broadcast: These are asynchronous and unordered. They are more efficient as they run unorderly and all at once. But, they lack full utilization of the results.

30. What are useful impotent folders in Android?

The impotent folders in an Android application are-

  1. build.xml- It is responsible for the build of Android applications.
  2. bin/ – The bin folder works as a staging area to wrap the files packages into the APK.
  3. src/ – The src is a folder where all the source files of the project are present.
  4. res/ – The res is the resource folder that stores values of the resources that are used in the application. These resources can be colors, styles, strings, dimensions, etc.
  5. assets/ – It provides a facility to include files like text, XML, fonts, music, and video in the Android application.

31. What are the important files for Android Application when working on Android Studio?

This is an important android studio interview question

There are following three files that we need to work on for an application to work-

a. The AndroidManifest.xml file: It has all the information about the application.

b. The MainActivity.java file: It is the app file that actually gets converted to the dalvik executable and runs the application. It is written in java.

c. The Activity_main.xml file: It is the layout file that is available in the res/layout directory. It is another mostly used file while developing the application.

32. Which database do you use for Android Application development?

The database that we use for Android Applications is SQLite. It is because SQLite is lightweight and specially developed for Android Apps. SQLite works the same way as SQL using the same commands.

33. Tell us some features of Android OS.

The best features of Android include-

  1. Multi-tasking
  2. Support for a great range of languages
  3. Support for split-screen
  4. High connectivity with 5G support
  5. Motion Control

34. Why did you learn Android development?

Learning Android Studio is a good idea because of the following-

  1. It has a low application development cost.
  2. It is an open-source platform.
  3. It has multi-platform support as well as Multi-carrier support.
  4. It is open for customizations.
  5. Android is a largely used operating system throughout the world.

35. What are the different ways of storage supported in Android?

The various storage ways supported in Android are as follows:

  1. Shared Preference
  2. Internal Storage
  3. External Storage
  4. SQLite Databases
  5. Network Connection

36. What are layouts?

Layout is nothing but arrangements of elements on the device screen. These elements can be images, tests, videos, anything. They basically define the structure of the Android user interface to make it user friendly.

37. How many layout types are there?

The type of layouts used in Android Apps are as follows:

  1. Linear Layout
  2. Relative Layout
  3. Constraint Layout
  4. Table Layout
  5. Frame Layout
  6. Absolute Layout
  7. Scrollview layout

38. What is an APK?

An APK stands for Android Package that is a file format of Android Applications. Android OS uses this package for the distribution and installation of the Android Application.

39. What is an Android Manifest file?

The manifest file describes all the essential information about the project application for build tools, Android operating system, and google play. This file is a must for every Android project that we develop, and it is present in the root of the project source set.

#android tutorials #android basic interview questions #android basic questions #android developer interview questions #android interview question and answer #android interview questions #android interview questions for experienced #android interview questions for fresher

Tyrique  Littel

Tyrique Littel

1600135200

How to Install OpenJDK 11 on CentOS 8

What is OpenJDK?

OpenJDk or Open Java Development Kit is a free, open-source framework of the Java Platform, Standard Edition (or Java SE). It contains the virtual machine, the Java Class Library, and the Java compiler. The difference between the Oracle OpenJDK and Oracle JDK is that OpenJDK is a source code reference point for the open-source model. Simultaneously, the Oracle JDK is a continuation or advanced model of the OpenJDK, which is not open source and requires a license to use.

In this article, we will be installing OpenJDK on Centos 8.

#tutorials #alternatives #centos #centos 8 #configuration #dnf #frameworks #java #java development kit #java ee #java environment variables #java framework #java jdk #java jre #java platform #java sdk #java se #jdk #jre #open java development kit #open source #openjdk #openjdk 11 #openjdk 8 #openjdk runtime environment

John David

John David

1558662911

Best Java Microservices Interview Questions In 2019

Top Microservices Interview Questions

According to Gartner, **microservices **are the new application platform for cloud development. **Microservices **are deployed and managed independently, and once implemented inside containers they have very little interaction with the underlying OS. So, if you are planning to start your career in the **Microservices **and you wish to know the skills related to it, now is the right time to dive in, when the technology is in its nascent state.

In case you have attended any **Microservices interview **in the recent past, do paste those interview questions in the comments section and we’ll answer them ASAP. You can also comment below if you have any **questions **in your mind, which you might face in your Microservices interview.

You may go through this recording of Microservices Interview Questions and **Answers **where our instructor has explained the topics in a detailed manner with examples that will help you to **understand **this concept better.

Q1. List down the advantages of Java Microservices Architecture.

Q2. What do you know about Microservices?

Microservices, aka Microservice Architecture, is an architectural style that structures an application as a collection of small autonomous services, modeled around a **business domain.**In layman terms, you must have seen how bees build their honeycomb by aligning hexagonal wax cells.They initially start with a small section using various materials and continue to build a large beehive out of it.These cells form a pattern resulting in a strong structure which holds together a particular section of the beehive.Here, each cell is independent of the other but it is also correlated with the other cells.This means that damage to one cell does not damage the other cells, so, bees can reconstruct these cells without impacting the complete beehive.

Fig 1: Beehive Representation of Microservices – Microservices Interview Questions

Refer to the above diagram. Here, each hexagonal shape represents an individual service component. Similar to the working of bees, each agile team builds an individual service component with the available frameworks and the chosen technology stack. Just as in a beehive, each service component forms a strong microservice architecture to provide better scalability. Also, issues with each service component can be handled individually by the agile team with no or minimal impact on the entire application.

Q3. What are the features of Microservices?

Fig 3: Features of Microservices – Microservices Interview Questions
Decoupling – Services within a system are largely decoupled. So the application as a whole can be easily built, altered, and scaled
Componentization
– Microservices are treated as independent components that can be easily replaced and upgradedBusiness Capabilities – Microservices are very simple and focus on a single capabilityAutonomy – Developers and teams can work independently of each other, thus increasing speedContinous Delivery – Allows frequent releases of software, through systematic automation of software creation, testing, and approvalResponsibility – Microservices do not focus on applications as projects. Instead, they treat applications as products for which they are responsibleDecentralized Governance – The focus is on using the right tool for the right job. That means there is no standardized pattern or any technology pattern. Developers have the freedom to choose the best useful tools to solve their problemsAgility – Microservices support agile development. Any new feature can be quickly developed and discarded again## Q4. What are the best practices to design Microservices?

The following are the best practices to design microservices:

**Fig 4: **Best Practices to Design Microservices – Microservices Interview Questions

Q5. How does Microservice Architecture work?

A microservice architecture has the following components:

**Fig 5: **Architecture of Microservices – Microservices Interview Questions
Clients – Different users from various devices send requests.Identity Providers – Authenticates user or clients identities and issues security tokens.API Gateway – Handles client requests.Static Content – Houses all the content of the system.Management – Balances services on nodes and identifies failures.Service Discovery – A guide to find the route of communication between microservices.Content Delivery Networks – Distributed network of proxy servers and their data centers.Remote Service – Enables the remote access information that resides on a network of IT devices.## Q6. What are the pros and cons of Microservice Architecture?

Q7. What is the difference between Monolithic, SOA and Microservices Architecture?

**Fig 6: **Comparison Between Monolithic SOA & Microservices – Microservices Interview Questions
Monolithic Architecture is similar to a big container wherein all the software components of an application are assembled together and tightly packaged.A Service-Oriented Architecture is a collection of services which communicate with each other. The communication can involve either simple data passing or it could involve two or more services coordinating some activity.Microservice Architecture is an architectural style that structures an application as a collection of small autonomous services, modeled around a business domain.## Q8. What are the challenges you face while working Microservice Architectures?

Developing a number of smaller microservices sounds easy, but the challenges often faced while developing them are as follows.
Automate the Components: Difficult to automate because there are a number of smaller components. So for each component, we have to follow the stages of Build, Deploy and, Monitor.Perceptibility: Maintaining a large number of components together becomes difficult to deploy, maintain, monitor and identify problems. It requires great perceptibility around all the components.Configuration Management: Maintaining the configurations for the components across the various environments becomes tough sometimes.Debugging: Difficult to find out each and every service for an error. It is essential to maintain centralized logging and dashboards to debug problems.## Q9. What are the key differences between SOA and Microservices Architecture?

The key differences between SOA and microservices are as follows:

Q10. What are the characteristics of Microservices?

You can list down the characteristics of microservices as follows:

**Fig 7: **Characteristics of Microservices – Microservices Interview Questions

Q11. What is Domain Driven Design?

**Fig 8: **Principles of DDD – Microservices Interview Questions

Q12. Why there is a need for Domain Driven Design (DDD)?

**Fig 9: **Factors Why we need DDD – Microservices Interview Questions

Q13. What is Ubiquitous language?

If you have to define the** Ubiquitous Language (UL)**, then it is a common language used by developers and users of a specific domain through which the domain can be explained easily.

The ubiquitous language has to be crystal clear so that it brings all the team members on the same page and also translates in such a way that a machine can understand.

Q14. What is Cohesion?

The degree to which the elements inside a module belong together is said to be cohesion.

Q15. What is Coupling?

The measure of the strength of the dependencies between components is said to be coupling. A good design is always said to have High Cohesion and** Low Coupling**.

Q16. What is REST/RESTful and what are its uses?

Representational State Transfer (REST)/RESTful web services are an architectural style to help computer systems communicate over the internet. This makes microservices easier to understand and implement.

Microservices can be implemented with or without RESTful APIs, but it’s always easier to build loosely coupled microservices using RESTful APIs.

Q17. What do you know about Spring Boot?

It’s a knows fact that spring has become more and more complex as new functionalities have been added. If you have to start a new spring project, then you have to add build path or add maven dependencies, configure application server, add spring configuration. So everything has to be done from scratch.

Spring Boot is the solution to this problem. Using spring boot you can avoid all the boilerplate code and configurations. So basically consider yourself as if you’re baking a cake spring is like the ingredients that are required to make the cake and spring boot is the complete cake in your hand.

**Fig 10: **Factors of Spring Boot – Microservices Interview Questions

Q18. What is an actuator in Spring boot?

Spring Boot actuator provides restful web services to access the current state of running an application in the production environment. With the help of actuator, you can check various metrics and monitor your application.

Q19. What is Spring Cloud?

According to the official website of Spring Cloud, Spring Cloud provides tools for developers to quickly build some of the common patterns in distributed systems (e.g. configuration management, service discovery, circuit breakers, intelligent routing, leadership election, distributed sessions, cluster state).

Q20. What problems are solved by Spring Cloud?

While developing distributed microservices with Spring Boot we face few issues which are solved by Spring Cloud.
**The complexity associated with distributed systems – **This includes network issues, Latency overhead, Bandwidth issues, security issues.**Ability to handle Service Discovery – **Service discovery allows processes and services in a cluster to find each other and communicate.**Solved redundancy issues – **Redundancy issues often occur in distributed systems.**Load balancing – **Improves the distribution of workloads across multiple computing resources, such as a computer cluster, network links, central processing units.**Reduces performance issues – **Reduces performance issues due to various operational overheads.## Q21. What is the use of WebMvcTest annotation in Spring MVC applications?

WebMvcTest annotation is used for unit testing Spring MVC Applications in cases where the test objective is to just focus on Spring MVC Components. In the snapshot shown above, we want to launch only the ToTestController. All other controllers and mappings will not be launched when this unit test is executed.

Q22. Can you give a gist about Rest and Microservices?

REST

Though you can implement microservices in multiple ways, REST over HTTP is a way to implement Microservices. REST is also used in other applications such as web apps, API design, and MVC applications to serve business data.

Microservices

Microservices is an architecture wherein all the components of the system are put into individual components, which can be built, deployed, and scaled individually. There are certain principles and best practices of Microservices that help in building a resilient application.

In a nutshell, you can say that REST is a medium to build Microservices.

Q23. What are different types of Tests for Microservices?

While working with microservices, testing becomes quite complex as there are multiple microservices working together. So, tests are divided into different levels.
At the bottom level, we have technology-facing tests like- unit tests and performance tests. These are completely automated.At the middle level, we have tests for exploratory testing like the stress tests and usability tests.At the **top level, **we have acceptance tests that are few in number. These acceptance tests help stakeholders in understanding and verifying software features.## Q24. What do you understand by Distributed Transaction?

Distributed Transaction is any situation where a single event results in the mutation of two or more separate sources of data which cannot be committed atomically. In the world of microservices, it becomes even more complex as each service is a unit of work and most of the time multiple services have to work together to make a business successful.

Q25. What is an Idempotence and where it is used?

Idempotence is the property of being able to do something twice in such a way that the end result will remain the same i.e. as if it had been done once only.

Usage: Idempotence is used at the remote service, or data source so that, when it receives the instruction more than once, it only processes the instruction once.

Q26. What is Bounded Context?

Bounded Context is a central pattern in Domain-Driven Design. It is the focus of DDD’s strategic design section which is all about dealing with large models and teams. DDD deals with large models by dividing them into different Bounded Contexts and being explicit about their inter-relationships.

Q27. What is Two Factor Authentication?

Two-factor authentication enables the second level of authentication to an account log-in process.

**Fig11: **Representation of Two Factor Authentication – Microservices Interview Questions

So suppose a user has to enter only username and password, then that’s considered a single-factor authentication.

Q28. What are the types of credentials of Two Factor Authentication?

The three types of credentials are:

**Fig 12: **Types of Credentials of Two Factor Authentication – Microservices Interview Questions

Q29. What are Client certificates?

A type of digital certificate that is used by client systems to make authenticated requests to a remote server is known as the** client certificate**. Client certificates play a very important role in many mutual authentication designs, providing strong assurances of a requester’s identity.

Q30. What is the use of PACT in Microservices architecture?

**PACT **is an open source tool to allow testing interactions between service providers and consumers in isolation against the contract made so that the reliability of Microservices integration increases.

Usage in Microservices:

Used to implement Consumer Driven Contract in Microservices.Tests the consumer-driven contracts between consumer and provider of a Microservice.## Q31. What is OAuth?

**OAuth **stands for open authorization protocol. This allows accessing the resources of the resource owner by enabling the client applications on HTTP services such as third-party providers Facebook, GitHub, etc. So with this, you can share resources stored on one site with another site without using their credentials.

Q32. What is Conway’s law?

“Any organization that designs a system (defined broadly) will produce a design whose structure is a copy of the organization’s communication structure.” –*** Mel Conway***

**Fig 13: **Representation of Conway’s Law – Microservices Interview Questions

This law basically tries to convey the fact that, in order for a software module to function, the complete team should communicate well. Therefore the structure of a system reflects the social boundaries of the organization(s) that produced it.

Q33. What do you understand by Contract Testing?

According to Martin Flower,** contract test **is a test at the boundary of an external service which verifies that it meets the contract expected by a consuming service.

Also, contract testing does not test the behavior of the service in depth. Rather, it tests that the inputs & outputs of service calls contain required attributes and the response latency, throughput is within allowed limits.

Q34. What is End to End Microservices Testing?

End-to-end testing validates each and every process in the workflow is functioning properly. This ensures that the system works together as a whole and satisfies all requirements.

In layman terms, you can say that end to end testing is a kind of tests where everything is tested after a particular period.

**Fig 14: **Hierarchy of Tests – Microservices Interview Questions

Q35. What is the use of Container in Microservices?

Containers are a good way to manage microservice based application to develop and deploy them individually*.* You can encapsulate your microservice in a container image along with its dependencies, which then can be used to roll on-demand instances of microservice without any additional efforts required.

**Fig 15: **Representation of Containers and How they are used in Microservices – Microservices Interview Questions

Q36. What is DRY in Microservices architecture?

DRY stands for Don’t Repeat Yourself. It basically promotes the concept of reusing the code. This results in developing and sharing the libraries which in turn result in tight coupling.

Q37. What is a Consumer-Driven Contract (CDC)?

This is basically a pattern for developing Microservices so that they can be used by external systems. When we work on microservices, there is a particular provider who builds it and there are one or more consumers who use Microservice.

Generally, providers specify the interfaces in an XML document. But in Consumer Driven Contract, each consumer of service conveys the interface expected from the Provider.

Q38. What is the role of Web, RESTful APIs in Microservices?

A microservice architecture is based on a concept wherein all its services should be able to interact with each other to build a business functionality. So, to achieve this, each microservice must have an interface. This makes the web API a very important enabler of microservices. Being based on the open networking principles of the Web, RESTful APIs provide the most logical model for building interfaces between the various components of a microservice architecture.

Q39. What do you understand by Semantic monitoring in Microservices architecture?

Semantic monitoring, also known as** synthetic monitoring** combines automated tests with monitoring the application in order to detect business failing factors.

Q40. How can we perform Cross-Functional testing?

Cross-functional testing is a verification of non-functional requirements, i.e. those requirements which cannot be implemented like a normal feature.

Q41. How can we eradicate non-determinism in tests?

Non-Deterministic Tests (NDT) are basically unreliable tests. So, sometimes it may happen that they pass and obviously sometimes they may also fail. As and when they fail, they are made to re-run to pass.

Some ways to remove non-determinism from tests are as follows:
QuarantineAsynchronousRemote ServicesIsolationTimeResource leaks## Q42. What is the difference between Mock or Stub?

Stub

A dummy object that helps in running the test.Provides fixed behavior under certain conditions which can be hard-coded.Any other behavior of the stub is never tested.
For example, for an empty stack, you can create a stub that just returns true for empty() method. So, this does not care whether there is an element in the stack or not.

Mock

A dummy object in which certain properties are set initially.The behavior of this object depends on the set properties.The object’s behavior can also be tested.
For example, for a Customer object, you can mock it by setting name and age. You can set age as 12 and then test for isAdult() method that will return true for age greater than 18. So, your Mock Customer object works for the specified condition.

Q43. What do you know about Mike Cohn’s Test Pyramid?

Mike Cohn provided a model called Test Pyramid. This describes the kind of automated tests required for software development.

**Fig 16: **Mike Cohn’s Test Pyramid – Microservices Interview Questions

As per pyramid, the number of tests at first layer should be highest. At service layer, the number of tests should be less than at the unit test level, but more than at the end-to-end level.

Q44. What is the purpose of Docker?

Docker provides a container environment that can be used to host any application. In this, the software application and the dependencies which support it are tightly-packaged together.

So, this packaged product is called a Container and since it is done by Docker, it is called Docker container!

Q45. What is Canary Releasing?

Canary Releasing is a technique to reduce the risk of introducing a new software version in production. This is done by slowly rolling out the change to a small subset of users before giving it out to the entire infrastructure, i.e. making it available to everybody.

Q46. What do you mean by Continuous Integration (CI)?

Continuous Integration (CI) is the process of automating the build and testing of code every time a team member commits changes to version control. This encourages developers to share code and unit tests by merging the changes into a shared version control repository after every small task completion.

Q47. What is Continuous Monitoring?

**Continuous monitoring **gets into the depth of monitoring coverage, from in-browser front-end performance metrics, through application performance, and down to host virtualized infrastructure metrics.

Q48. What is the role of an architect in Microservices architecture?

An architect in microservices architecture plays the following roles:
Decides broad strokes about the layout of the overall software system.Helps in deciding the zoning of the components. So, they make sure components are mutually cohesive, but not tightly coupled.Code with developers and learn the challenges faced in day-to-day life.Make recommendations for certain tools and technologies to the team developing microservices.Provide technical governance so that the teams in their technical development follow principles of Microservice.## Q49. Can we create State Machines out of Microservices?

As we know that each Microservice owning its own database is an independently deployable program unit, this, in turn, lets us create a State Machine out of it. So, we can specify different states and events for a particular microservice.

For Example, we can define an Order microservice. An Order can have different states. The transitions of Order states can be independent events in the Order microservice.

Q50. What are Reactive Extensions in Microservices?

Reactive Extensions also are known as Rx. It is a design approach in which we collect results by calling multiple services and then compile a combined response. These calls can be synchronous or asynchronous, blocking or non-blocking. Rx is a very popular tool in distributed systems which works opposite to legacy flows.

Hope these Microservices Interview Questions would help you in your Microservices Architect Interviews.

#java #spring-boot #interview #interview-questions

Mikel  Okuneva

Mikel Okuneva

1597135042

Top 50 Java Collections Interview Questions

Hello guys, Java Collection and Generic are a very important topic for Java Interviews. They also present some of the hardest questions to a programmer when it comes to interviews, especially Generics.

It’s not easy to first understand what a particular piece of code doing with those question marks and other signs and then the pressure of interviews also makes it hard to answer complex usage of Generics.

But, with proper preparation and paying attention to both Java Collection and Generic, you can solve that hurdle. If you are looking for Java job but haven’t done well in the interviews you have given so far then you have come to the right place.

In this article, I have shared a lot of Java interview questions on various topics and difficulty levels.

There are Java questions for beginners as well as expert programmers. They are theoretical questions based upon Java programming concepts as well as coding and data structure algorithms questions for programmers, and this article is only going to make that collection even more valuable.

In this article, I am going to share some of the frequently asked Java Collection and Generic questions from Interviews. These are the questions you have often seen on a telephonic round of Java interview as well as on face-to-face interviews.

It’s useful for both beginners having 2 to 3 years of experience as well as experienced Java programmers with 5 to 6 years of experience.

This list has a collection of questions which has both easy and tough questions in it but the most important thing is that most of the questions have already been asked on interviews. I am sure you might have also seen it in your interviews.

knowing the answers to these questions will not only help you to crack your Java interview but also understand Java Generics and Collection topic in-depth, which will eventually help you to write better Java programmers and code.

Btw, if you are new to Java or want to solidify your Java knowledge then you should check out a comprehensive course like The Complete Java Masterclass before attempting to solve these questions. It will help you immensely by filling gaps in your knowledge and going back and forth. It’s also the most up-to-date course and covers every new feature introduced in new Java releases

50+ Java Collection and Generic Interview Questions

Without wasting any more of your time, here is my list of 50+ Java interview questions on Collection and Generics.

If you have done some work in Java +then you should know the answer to these questions but if you don’t you can always see the answer.

Instead of writing answers here, I have linked them to relevant posts so that you can try to solve the problem by yourself here and if you need you can get an in-depth discussion on individual posts to learn the topic in depth.

1) What is the Java Collection Framework and How do you choose different collections? (answer)

Here is the diagram which answers this question:

storing multiple objects

2) What are Generics in Java? (answer)

hint: Java feature to ensure type safety at compile time.

3) Which are your favorites classes from Java Collection Framework? (answer)

hint: Collection, ListSetMapArrayListVectorLinkedListHashMap, etc

4) When do you use Set, List, and Map in Java? (answer)

hint — use set when you don’t need duplicates, use List when you need order with duplicates, and use Map when you need to store key-value pair.

5) Which Sorted Collection have you used? (answer)

hint — TreeSet is one example of a sorted Collection

6) How HashSet works in Java? (answer)

hint — same as HashMap, using hashing and equals() and hashCode() method. HashSet is actually backed by HashMap where keys are elements you store in HashSet and values are always null.

**7) Which two methods you should override for an Object to be used as a key in hash-based Collections? **(answer)

hint — equals and hashcode

**8) Can you use HashMap in a concurrent application? **(answer)

hint — Yes, but only if you are reading from the HashMap and its initialized by a single thread, otherwise no.

**9) What is the difference between HashMap and Hashtable in Java? **(answer)

hint — HashMap is fast but not threadsafe, Hashtable is slow but thread-safe

** 10) What is the difference between synchronized and concurrent Collection in Java? (answer)**

11) How ConcurrentHashMap works in Java? (answer)

partitions map into segments and lock them individually instead of locking the whole map.

12) What is PriorityQueue in Java? (answer)

A data structure that always keeps the highest or lowest element at the head so that you can access or remove it in constant time.

**13) What is type-erasure in Generics? **(answer)

Its a part of Java compiler which removes all type related information after compilation from Java so that the generated code is the same as before Generics.

** 14) What is the difference between ArrayList and Vector in Java? (answer)**

hint — ArrayList is not synchronized hence fast, Vector is synchronized hence slow

15) What is the difference between LinkedList and ArrayList in Java? (answer)

hint — ArrayList is backed by array while LinkedList is backed by a linked list which means search with index is only possible in ArrayList.

** 16) What is the difference between Hashtable and ConcurrentHashMap in Java? (answer)**

hint — ConcurrentHashMap is a new concurrent class with better scalability as only a portion of the map called segment is locked while Hashtable is an old class where the whole map is Locke for synchronization. Seet **Java Collections: Fundamentals **course for more details.

java collection framework

17) What is the difference between LinkedHashSet and TreeSet in Java? (answer)

hint — TreeSetis a sorted set where elements are stored in their natural or custom sorting order depending upon comparable and comparator while LinkedHashSet is just an ordered collection that maintains insertion order.

#java #interview #java interview #interview-questions

Were  Joyce

Were Joyce

1620815880

Top 40 Questions for a Spring Framework Interview

40 Spring questions and answers to prepare for your next interview.

The Spring framework makes J2EE (Java 2 Platform Enterprise Edition) development easier and is used to create testable, high performing, reusable code. Spring is commonly applied in the information technologies and financial sector due to its modularity and dependency injection features.

Financial technology is an exciting and evolving field for developers who want to work at companies like MIT, Accenture, or Visa, which prefer Spring over Java EE. These companies are looking for developers like you with Spring Framework experience to help digitize their enterprise needs.

But, how do you know if you’re ready for an interview? And how do you prepare?

Today, we’ll go through a study guide of the top 40 Spring interview questions to make sure you’re ready to ace your Spring Framework interview.

Here’s what we’ll cover today:

  • What is the Spring Framework?
  • What to expect from a Spring Framework interview
  • Top 40 Questions for Spring Framework
  • Wrapping up and what to learn next

#spring boot #j2ee #spring framework #interview questions #enterprise java #interview preparation #coding interview question #enterprise java beans #java beans #spring boot framework