Ernst & Young
10+ Jumpfactor Interview Questions and Answers
Q1. Smallest Subarray With K Distinct Elements
Given an array A
consisting of N
integers, your task is to find the smallest subarray of A
that contains exactly K
distinct integers.
If multiple such subarrays exist,...read more
Find the smallest subarray in an array with exactly K distinct elements.
Use a sliding window approach to keep track of the subarray with K distinct elements.
Use a hashmap to store the frequency of each element in the window.
Update the window by expanding or shrinking based on the number of distinct elements.
Return the smallest subarray with K distinct elements and the smallest leftmost index.
ArrayList is non-synchronized and Vector is synchronized in Java.
ArrayList is not synchronized, while Vector is synchronized.
ArrayList is faster than Vector.
Vector is thread-safe, while ArrayList is not.
Example: ArrayList<String> list = new ArrayList<>(); Vector<String> vector = new Vector<>();
HashSet is a collection of unique elements, while HashMap is a key-value pair mapping.
HashSet does not allow duplicate elements, HashMap allows duplicate keys but not values.
HashSet uses a hash table to store elements, HashMap uses key-value pairs.
Example: HashSet<String> set = new HashSet<>(); HashMap<String, Integer> map = new HashMap<>();
HashMap and Hashtable are both data structures in Java used to store key-value pairs, but Hashtable is synchronized while HashMap is not.
HashMap allows null values and one null key, while Hashtable does not allow null keys or values.
HashMap is not synchronized and is not thread-safe, while Hashtable is synchronized and thread-safe.
HashMap is faster than Hashtable for most operations, as it is not synchronized.
HashMap is part of the Java Collections Framework, while Hashtable ...read more
The @RestController annotation in Spring Boot is used to define a class as a RESTful controller.
Used to create RESTful web services in Spring Boot
Combines @Controller and @ResponseBody annotations
Eliminates the need for @ResponseBody annotation on each method
Returns data directly in the response body as JSON or XML
Java Strings are immutable to ensure thread safety, security, and optimization.
Immutable strings prevent accidental changes, ensuring data integrity.
String pooling allows for memory optimization by reusing common strings.
Thread safety is guaranteed as strings cannot be modified concurrently.
Security is enhanced as sensitive information cannot be altered once set.
Java 8 program to iterate through a Stream using forEach method
Create a Stream of elements using Stream.of() or any other method
Use the forEach() method to iterate through the Stream and perform an action on each element
Example: Stream.of(1, 2, 3, 4, 5).forEach(System.out::println);
Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured setups.
Auto-configuration: Spring Boot automatically configures the application based on dependencies added to the project.
Embedded server: Spring Boot comes with an embedded Tomcat, Jetty, or Undertow server for easy deployment.
Actuator: Provides production-ready features like monitoring, metrics, and health checks for the application.
JIT compiler stands for Just-In-Time compiler, which compiles code during runtime for improved performance.
JIT compiler translates bytecode into machine code at runtime
It helps in optimizing performance by compiling frequently executed code
Examples include Java HotSpot JIT compiler and .NET JIT compiler
MVC in Spring is a design pattern that separates an application into three main components: Model, View, and Controller.
Model represents the data and business logic of the application.
View is responsible for rendering the user interface based on the data from the Model.
Controller acts as an intermediary between Model and View, handling user input and updating the Model accordingly.
Spring MVC provides annotations like @Controller, @RequestMapping, and @ModelAttribute to implem...read more
Spring Boot is a framework that simplifies the development of Java applications by providing pre-configured settings and tools.
Spring Boot eliminates the need for manual configuration by providing defaults for most settings.
It includes embedded servers like Tomcat, Jetty, or Undertow, making it easy to run applications as standalone JAR files.
Spring Boot also offers production-ready features like metrics, health checks, and externalized configuration.
It allows developers to q...read more
Java 8 streams are a sequence of elements that support functional-style operations.
Streams allow for processing sequences of elements in a functional way.
They can be created from various data sources like collections, arrays, or I/O channels.
Operations like filter, map, reduce, and collect can be performed on streams.
Streams are lazy, meaning intermediate operations are only executed when a terminal operation is called.
Example: List<String> names = Arrays.asList("Alice", "Bob...read more
Dependency injection is a design pattern in which components are given their dependencies rather than creating them internally.
Dependency injection helps in achieving loose coupling between classes.
It allows for easier testing by providing mock dependencies.
There are three types of dependency injection: constructor injection, setter injection, and interface injection.
More about working at Ernst & Young
Top HR Questions asked in Jumpfactor
Top Technology Consultant Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month