Page cover image

Mastercard

Java Language Fundamentals

  • Can we extend string class?

  • Why string class is immutable?

  • What is the difference between String = "s" and new String("s")

  • Are strings eligible for garbage collection

  • Explain the deep explanation of equals/hashcode method.

  • What are immutable objects

  • Java Call by value or call by reference? Demonstrate using an example.

  • What is generics in Java

  • Class vs object

  • How to create a class as static

  • What happens when return is used inside a try block

  • What happens when System.exit() is used inside a try block

  • What is the difference between path and classpath

  • Can a constructor be made final?

  • What is the finalize method?

  • Explain the Stream API in Java 8.

  • Explain interfaces in the collection framework.

Threads and Concurrency

Collections

  • HashMap internals

  • Concurrent HashMap vs HashMap

  • Benefits of Optional class

  • Java 8/9 features - Questions around Optional class, Stream API

  • What are the methods provided by HashMap

  • How to handle custom objects as key in HashMap

  • If equals returns true and hashcode method returns false in HashMap, will it add the object

  • Explain Queue data structure.

  • What problems are related to tree data structures?

Design Patterns

  • Java design patterns - Explain at least 1 or 2 patterns from each category

  • Demonstrate the builder pattern

  • Demonstrate the observer pattern / strategy pattern

  • Factory Design Pattern

  • Builder Design Pattern

  • Which design patterns have you used in your project

Exceptions and Errors

  • Can we catch the error?

  • Can have custom exceptions? Can we have custom errors?

Coding

  • Find odd numbers from list of integers using Stream API

  • Write a method to identify vowels in a string and number of times vowels are repeated in the same string

  • Return true if a list of numbers contains odd numbers, false otherwise using Java 8

  • Describe your role in your current project

  • How to review code of your team members and which rules you keep in mind

  • Explain how to find the kth smallest element in an organization, where k represents the third youngest student.

Spring Boot

  • How to establish connection to DB in Spring Boot?

  • Can we do autowiring by interface?

  • In case of autowiring by interface, what if there are two different implementations? Which bean will be autowired?

  • How to change the default web server in Spring Boot

  • How to retry in Spring Boot

  • How to do a health check

  • What is the difference between @Component, @Service, and @Autowire annotations

  • What is JPA

  • Have you used Hibernate JPA in your Spring Boot application and how

  • What is the difference between SpringRunner and Mockito

  • What is the difference between soap and REST API

  • What is the difference between JSON and XML

  • What is @RequestBody and @ResponseBody annotation

  • What is @RequestMapping annotation

  • What is Spring Actuator

  • What are the REST API URL patterns

  • Create a REST controller class and add all HTTP methods

  • Explain @Primary annotation.

  • How to resolve circular dependency problem?

  • When to use @SpringBootApplication and @EnableAutoConfiguration annotations?

Microservices

  • Can we establish parallel connections to separate DB in Java?

  • Exception handling in microservices

  • Circuit breaker pattern

  • Data consistency in microservices in case of failure

  • How to scale a pod in case of load (e.g. 70%)

  • Benefits of microservices architecture? How is it different from monolithic application?

  • How to do health check of microservices

  • How to retry if a service is down

  • How do circuit breakers work

Testing

  • Different types of testing used in a project

  • How to mock objects in unit tests?

  • Questions around the Mockito library

  • What is a contract test / functional test / integration test, etc.

  • Explain the CI/CD process

Miscellaneous

  • What is Sonar and what is its use

  • Give a rating score of your skills

Last updated

Was this helpful?