JP Morgan interview experience Real time questions & tips from candidates to crack your interview

Fullstack Developer

JP Morgan
upvote
share-icon
3 rounds | 19 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 months
Topics: Java , OOPS, Spring , Hibernate, MVC Architecture
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Referral
Eligibility: Above 3 years of experience
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Video Call
Duration60 Minutes
Interview date17 Nov 2022
Coding problem6

This round had questions mainly from Java 8 and its important features followed by some questions from Spring Boot.

1. Java Question

What are Java 8 streams?

Problem approach

A stream is an abstraction to express data processing queries in a declarative way. 

A Stream, which represents a sequence of data objects & series of operations on that data is a data pipeline that is not related to Java I/O Streams does not hold any data permanently.
The key interface is java.util.stream.Stream. It accepts Functional Interfaces so that lambdas can be passed. Streams support a fluent interface or chaining.

2. Java Question

Write a Java 8 program to iterate a Stream using the forEach method?

Problem approach

In this program, we are iterating a Stream starting from “number = 2”, followed by the count variable incremented by “1” after each iteration.

Then, we are filtering the number whose remainder is not zero when divided by the number 2. Also, we have set the limit as 5 which means only 5 times it will iterate. Finally, we are printing each element using forEach.


//Code : 

import java.util.stream.*; 
public class Java8 { 

public static void main(String[] args){ 
Stream.iterate(2, count->count+1) 

// Counter Started from 2, incremented by 1

.filter(number->number%2==0) 

// Filtered out the numbers whose remainder is zero
// when divided by 2

.limit(5) 
// Limit is set to 5, so only 5 numbers will be printed

.forEach(System.out::println);

}

3. SpringBoot Question

How does Spring Boot works?

Problem approach

Spring Boot automatically configures your application based on the dependencies you have added to the project by using annotation. The entry point of the spring boot application is the class that contains @SpringBootApplication annotation and the main method.

Spring Boot automatically scans all the components included in the project by using @ComponentScan annotation.

4. SpringBoot Question

What is dependency Injection?

Problem approach

The process of injecting dependent bean objects into target bean objects is called dependency injection.

Setter Injection : The IOC container will inject the dependent bean object into the target bean object by calling the setter method.

Constructor Injection : The IOC container will inject the dependent bean object into the target bean object by calling the target bean constructor.

Field Injection : The IOC container will inject the dependent bean object into the target bean object by Reflection API.

5. SpringBoot Question

Explain @RestController annotation in Sprint boot?

Problem approach

It is a combination of @Controller and @ResponseBody, used for creating a restful controller. It converts the response to JSON or XML. It ensures that data returned by each method will be written straight into the response body instead of returning a template.

6. Java Question

What are the different methods of session management in Servlet?

Problem approach

A session is a conversational state between client and server and it can consist of multiple requests and responses between client and server. Therefore, HTTP and web server both are stateless, the only way to maintain a session is when some unique information about the session (session-id) is passed between server and client in every request and response. We can use the following methods to maintain the session :

1) User Authentication
2) HTML Hidden Field
3) Cookies
4) URL Rewriting
5) Session Management API

02
Round
Medium
Video Call
Duration60 Minutes
Interview date17 Nov 2022
Coding problem6

This was a preety much mixed round ranging questions from Java , MVC to DBMS , Web Security and API Design. More emphasis was given on the fundamentals of the subject rather than the advanced topics.

1. Java Question

What is a package in Java? List down various advantages of packages.

Problem approach

Packages in Java, are the collection of related classes and interfaces which are bundled together. By using packages, developers can easily modularize the code and optimize its reuse. Also, the code within the packages can be imported by other classes and reused. Below I have listed down a few of its advantages:

1) Packages help in avoiding name clashes
2) They provide easier access control on the code
3) Packages can also contain hidden classes which are not visible to the outer classes and only used within the package
4) Creates a proper hierarchical structure which makes it easier to locate the related classes

2. MVC Question

What is CORS in MVC and how it works?

Problem approach

CORS stands for Cross-Origin Resource Sharing. It is a W3C standard and HTTP-header-based mechanism. It permits a server to indicate any other origins (like domain, port, etc.) instead of the requested one. In other words, it enables one website to access the resources of another website using JavaScript.

It supports secure cross-origin requests and transfers data between servers and browsers. Advanced browsers use CORS in APIs. It is flexible and safe in comparison to JSONP (JSON with Padding). It provides better web service integration.

While using the MVC to enable CORS, the same CORS service can be used but we cannot use the same CORS middleware. We can use a particular CORS for a particular action, for a particular controller, and globally for all controllers.

A pre-flight check (or request) is sent by the browser to the server (hosting the cross-origin resource) which ensures that the server will permit the actual request or not.

3. MVC Question

Explain in brief the role of different MVC components?

Problem approach

The different MVC components have the following roles -

Presentation : This component takes care of the visual representation of a particular abstraction in the application.

Control : This component takes care of the consistency and uniformity between the abstraction within the system along with their presentation to the user. It is also responsible for communicating with all other controls within the MVC system.

Abstraction : This component deals with the functionality of the business domain within the application.

4. DBMS Question

What are the difference between Clustered and a Non-clustered index?

Problem approach

1) With a Clustered index the rows are stored physically on the disk in the same order as the index. Therefore, there can be only one clustered index. A clustered index means you are telling the database to store close values actually close to one another on the disk.

2) With a Non Clustered index there is a second list that has pointers to the physical rows. You can have many non clustered indices, although each new index will increase the time it takes to write new records.

3) It is generally faster to read from a clustered index if you want to get back all the columns. You do not have to go first to the index and then to the table.

4) Writing to a table with a clustered index can be slower, if there is a need to rearrange the data.

5. Web Security Question

What is SQL injection?

Problem approach

Injection attacks stem from a lack of strict separation between program instructions (i.e., code) and user-provided (or external) input. This allows an attacker to inject malicious code into a data snippet.

SQL injection is one of the most common types of injection attack. To carry it out, an attacker provides malicious SQL statements through the application.

How to prevent :

1) Prepared statements with parameterized queries
2) Stored procedures
3) Input validation - blacklist validation and whitelist validation
4) Principle of least privilege - Application accounts shouldn’t assign DBA or admin type access onto the database server. This ensures that if an application is compromised, an attacker won’t have the rights to the database through the compromised application.

6. Technical Question

What are the advantages of Web Services?

Problem approach

Some of the advantages of web services are:

1) Interoperability : Web services are accessible over network and runs on HTTP/SOAP protocol and uses XML/JSON to transport data, hence it can be developed in any programming language. Web service can be written in java programming and client can be PHP and vice versa.

2) Reusability : One web service can be used by many client applications at the same time.

3) Loose Coupling : Web services client code is totally independent with server code, so we have achieved loose coupling in our application.

4) Easy to deploy and integrate, just like web applications.

5) Multiple service versions can be running at same time.

03
Round
Medium
Video Call
Duration45 Minutes
Interview date17 Nov 2022
Coding problem7

This round started with some questions from Frontend Web Development primarily from HTML and CSS followed by some questions from DevOps and Git. The interviewer was quite satisfied by my answers and overall this round went preety well.

1. Frontend Question

How to optimize website assets loading?

Problem approach

To optimize website load time we need to optimize its asset loading and for that:

1) CDN hosting - A CDN or content delivery network is geographically distributed servers to help reduce latency.

2) File compression - This is a method that helps to reduce the size of an asset to reduce the data transfer

3) File concatenation - This reduces the number of HTTP calls

4) Minify scripts - This reduces the overall file size of js and CSS files

5) Parallel downloads - Hosting assets in multiple subdomains can help to bypass the download limit of 6 assets per domain of all modern browsers. This can be configured but most general users never modify these settings.

6) Lazy Loading - Instead of loading all the assets at once, the non-critical assets can be loaded on a need basis.

2. HTML Question

In how many ways can we position an HTML element? Or what are the permissible values of the position attribute?

Problem approach

There are mainly 7 values of position attribute that can be used to position an HTML element:

1) static: Default value. Here the element is positioned according to the normal flow of the document.

2) absolute: Here the element is positioned relative to its parent element. The final position is determined by the values of left, right, top, bottom.

3) fixed: This is similar to absolute except here the elements are positioned relative to the element.

4) relative: Here the element is positioned according to the normal flow of the document and positioned relative to its original/ normal position.

5) initial: This resets the property to its default value.

6) inherit: Here the element inherits or takes the property of its parent.

3. HTML Question

What are the New tags in Media Elements in HTML5?

Problem approach

1) - Used for sounds, audio streams, or music, embed audio content without any additional plug-in.
2) - Used for video streams, embed video content etc.
3) - Used for multiple media resources in media elements, such as audio, video, etc.
4) - Used for an external application or embedded content.
5) - Used for subtitles in the media elements such as video or audio.

4. CSS Question

Difference between reset vs normalize CSS?. How do they differ?

Problem approach

Reset CSS: CSS resets aim to remove all built-in browser styling. For example margins, paddings, font-sizes of all elements are reset to be the same. 

Normalize CSS: Normalize CSS aims to make built-in browser styling consistent across browsers. It also corrects bugs for common browser dependencies.

5. CSS Question

What is a z-index, how does it function?

Problem approach

z-index is used for specifying the vertical stacking of the overlapping elements that occur at the time of its positioning. It specifies the vertical stack order of the elements positioned that helps to define how the display of elements should happen in cases of overlapping.

The default value of this property is 0 and can be either positive or negative. Apart from 0, the values of the z-index can be:

1) Auto: The stack order will be set equal to the parent.
2) Number: The number can be positive or negative. It defines the stack order.
3) Initial: The default value of 0 is set to the property.
4) Inherit: The properties are inherited from the parent.

The elements having a lesser value of z-index is stacked lower than the ones with a higher z-index.

6. DevOps Question

Explain a use case for Docker?

Problem approach

1) Docker is a low overhead way to run virtual machines on your local box or in the cloud. Although they’re not strictly distinct machines, they give you many of those benefits.

2) Docker can encapsulate legacy applications, allowing you to deploy them to servers that might not otherwise be easy to set up with older packages & software versions.

3) Docker can be used to build test boxes, during your deploy process to facilitate continuous integration testing.

4) Docker can be used to provision boxes in the cloud, and with the swarm, you can orchestrate clusters too.

7. Git Question

What is the Difference Between “Git Pull” and “Git Fetch”?

Problem approach

In the simplest terms, git pull does a git fetch followed by a git merge.

1) When you use pull, Git gets the message to automatically do your work for you. It is context-sensitive, so Git will merge any pulled commits into the branch you are currently working in. pull automatically merges them without giving you any chance to review it first. If you don’t manage your branches with a keen eye, you may be face to face with many problems.

2) When you fetch, Git gathers any commits from the target branch that do not exist in your current branch and stores them in your local repository. However, it does not merge them with your current branch. This is particularly useful if you need to keep your repository up to date, but are working on something that might break if you update your files. To integrate the commits into your master branch, you use merge.

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which array operation has O(n) worst-case time complexity?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 2
4 rounds | 7 problems
Interviewed by JP Morgan
4773 views
0 comments
0 upvotes
company logo
Software Engineer
4 rounds | 3 problems
Interviewed by JP Morgan
2205 views
0 comments
0 upvotes
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by JP Morgan
2435 views
0 comments
0 upvotes
company logo
SDE - 1
1 rounds | 2 problems
Interviewed by JP Morgan
1615 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Fullstack Developer
6 rounds | 5 problems
Interviewed by Microsoft
1843 views
0 comments
0 upvotes
company logo
Fullstack Developer
4 rounds | 10 problems
Interviewed by Paytm (One97 Communications Limited)
1574 views
1 comments
0 upvotes
company logo
Fullstack Developer
2 rounds | 2 problems
Interviewed by Samsung
1720 views
0 comments
0 upvotes