JP Morgan Interview Questions
J.P Morgan is an American multinational bank holding company. It is the global leader in financial services that offers solutions to corporations, governments, and institutions. Its headquarter is situated in New York. It is the largest bank in the United States. As announced by JP Morgan earlier in 2018, it has the vision to deploy $1.75 billion in philanthropic capital around the world by 2023.
JP Morgan is known for a great work-life balance and provides decision-making opportunities to help you to grow in the corporate world. As a software engineer, you will develop innovative solutions that would impact the day-to-day lives of billions of people. At JP Morgan, you will get the opportunity to work in an open, collaborative and supportive culture.
JP Morgan Technical Interview Questions: Freshers and Experienced
1. Define Bus Topology.
Bus topology is an arrangement of devices in which all the computers or devices are connected to a single data line. Data is transmitted from one point to another (One-way flow).
Useful Resources
- Python Interview Questions
- Java Interview Questions
- Selenium Interview Questions
- Automation Testing Interview Questions
- Software Engineering Interview Questions
- Full Stack Developer Interview Questions
- Front End Developer Interview Questions
- Technical Interview Questions
- Coding Interview Questions
- Interview Resources
2. How UNION is different from UNION all?
Union is an SQL command and it is used to join two or more sets into a single set. Two queries can be combined easily into a single result set using the select statements.
Syntax:
Query1 UNION Query2
Example:
Consider that we have two tables:
Organization1
Employee_Name | Employee_ID |
---|---|
Rahul | 7 |
Amit | 11 |
Sumit | 18 |
Organization2
Employee_ Name | Employee_ID |
---|---|
Anita | 14 |
Priyesh | 24 |
Harshit | 25 |
SELECT Employee_Name from Organization1 UNION SELECT Employee_Name FROM Organization2
Result:
Employee_Name |
---|
Rahul |
Amit |
Sumit |
Anita |
Priyesh |
Harshit |
Here, we have used two different tables for extraction of rows but the column specified for extraction is the same for both. Like UNION, we will get an error if different columns are used. It is important to note that the data type specified also must be the same for both queries. Note that the result of UNION contains distinct values only.
Union ALL is also an SQL command and it is also used to join two or more sets into a single set (like UNION). The only difference between UNION and UNION ALL is that UNION marks distinct entries only, whereas the result of UNION ALL may contain duplicate values as well.
Example:
Consider that we have two tables:
Organization1
Employee_Name | Employee_ID |
---|---|
Rahul | 7 |
Amit | 11 |
Sumit | 18 |
Organization2
Employee_ Name | Employee_ID |
---|---|
Anita | 14 |
Sumit | 11 |
Harshit | 25 |
SELECT Employee_Name from Organization1 UNION ALL SELECT Employee_Name FROM Organization2
Result:
Employee_ Name |
---|
Rahul |
Amit |
Sumit |
Anita |
Sumit |
Harshit |
Here, we have used two different tables for the extraction of rows but the column specified for extraction is the same for both. Like UNION, We will get an error if different columns are used. It is important to note that the data type specified also must be the same for both queries. Note that the result of UNION ALL can contain duplicate values as well.
3. Differentiate between super key and primary key?
Super Key | Primary Key |
---|---|
Super key is an attribute (or set of attributes) that uniquely identifies all attributes in a relation. | Primary Key is a minimum set of an attribute (or set of attributes) that has the capability to uniquely identify all attributes in a relation. |
For relation, the number of super keys is more than the number of primary keys. | For relation, the number of primary keys is less than the number of super keys. |
Super key attributes can contain NULL values. | Primary key attributes cannot contain NULL values. |
4. What do you mean by virtual functions in C++?
- A virtual function is a member function that is declared within a base class and defined (or overridden) under a derived class.
- A virtual function can be declared using a virtual keyword. It tells the compiler to do dynamic binding on that function.
- A virtual function cannot be declared as static.
5. Problem statement: You are given an array nums having n integers colored red, white, or blue, sort them in place so that objects of the same color are adjacent, with the colors in the order red, white, and blue.
Here 0, 1, and 2 represent the colors red, white, and blue, respectively.
Input Format:
You are required to complete void sortColors(vector<int> &nums) function.
Output:
You are not required to return anything (Just sort the array)
Constraints:
1 <= n <= 10^5
nums[i] can be 0, 1 and 2 only for i in the range 0 <= i <= n - 1
Time Limit: 1 sec
Sample Input 1:
Sample Output 1:
Sample Input 2:
Sample Output 2:
Approaches
1. Sort the array using the merge sort algorithm:
- We can simply sort the array using the merge sort algorithm.
- Time Complexity: O(N Log N) where N is the number of elements in the array.
- Space Complexity: O(1)
2. Using three variables:
- We can create three variables zero, one and two. All are initialized as 0. Now we will iterate over the nums and increment zero by once if the current element is 0 or increment one by once if the current element is 1 otherwise we will increment two by once.
- Then, we will iterate through the nums again and start assigning 0 at positions and decrementing the value zero unless and until zero becomes equal to 0, then we will continue the same thing for one and then for two.
- Time Complexity: O(N) Where N is the number of elements in the array.
- Space Complexity: O(1)
3. Dutch National Flag algorithm: Though, the second approach mentioned above takes O(N) time. But sometimes the interviewer puts forward the constraint to solve the problem in a single pass only.
- Let’s initialise three-pointers low, mid and high as 0, 0 and N - 1 respectively.
- We will iterate over nums till mid is less than equal to high.
- If at any step the value of nums at the index mid is equal to 0 then we will swap elements at the positions low and mid. Also, we will increment both low and mid by one.
- Else if the value at the index mid is equal to 2, we will swap the values at positions mid and high. Also, we will decrement the value of high by one.
- Otherwise, we will increment the value of mid by one.
In this way, we will be able to sort the given array in a single pass only.
Source Code:
class Solution {
public:
void sortColors(vector<int>& nums) {
/*
0 ... low - 1 : 0
low ... mid - 1 : 1
mid ... n - 1 : 2
*/
// Get the size of the given vector
int n = nums.size();
// Initialize three variables
int low = 0, mid = 0, high = n - 1;
// Iterate till mid is less than or equal to high
while(mid <= high)
{
/*
If the value stored at
mid is zero
then swap value stored at mid
with the value store at low
increment low and mid by one
*/
if(nums[mid] == 0)
{
swap(nums[mid], nums[low]);
mid++;
low++;
}
/*
Else if the value stored at
mid is 2
then swap value stored at mid
with the value store at high and
decrement the high variable by one
*/
else if(nums[mid] == 2)
{
swap(nums[high], nums[mid]);
high--;
}
/*
Else increment mid by one
*/
else
mid++;
}
// At the end nums will become sorted
}
};
6. Differentiate between String and StringBuffer?
String | StringBuffer |
---|---|
It is a non-mutable class. | It is a mutable class. |
It is slow and consumes more memory space. | It is fast and takes less memory space. |
The string class uses a string pool area. | StringBuffer uses heap memory. |
String class overrides the equals() method of an object class. So using the equals() method you can compare two strings easily. | StringBuffer class doesn't override the equals() method of an object class. |
7. What is a singleton class?
Singleton class is a class that can have only one object at a time. After this, if you further try to create an object of the Singleton class, then the new variable also points to the first object that you had created initially. So whatever changes you do to any variable inside the class through any object, it affects the variable of the single instance created.
8. Problem statement: You are given the head of a linked list, to determine whether the cycle is present in the linked list.
Input Format:
You are required to complete bool hasCycle(ListNode* head) function.
Output:
True: If loop or cycle is present
False: Otherwise
Constraints:
1 <= Number of nodes in both the lists <= 10^5
-10^5 <= Node.Val <= 10^5
Time Limit: 1 sec
Sample Input 1:
Sample Output 1:
True
Sample Input 2:
Sample Output 2:
False
Approach
To solve this problem, you need to go back to your high school physics. Let us consider a scenario in which you and one of your friends are running on a circular track but with different speeds. You both started running at the same point initially. Now a moment would come when you both again meet at some position.
We can use this concept to solve this problem.
Source Code:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
class Solution {
public:
bool hasCycle(ListNode *head) {
/*
slow pointer moves one step forward at a time
fast pointer moves two step forward at a time
*/
ListNode* slow = head;
ListNode* fast = head;
/*
Iterating using do while loop to check
*/
do
{
/*
Since, fast pointer moves faster
hence if loop is not present in the linked list
then it will the first to encounter NULL
*/
if(!fast)
return false;
/*
Otherwise we will move slow pointer and fast pointer
one step forward
If fast pointer is not NULL then we will move
fast pointer again one step forward
Otherwise, we would return false
*/
slow = slow -> next;
fast = fast -> next;
if(fast)
fast = fast -> next;
else
return false;
}
while(slow != fast);
/*
If everything remains fine that it means both pointers
now point to the same node
Hence, we will return true
*/
return true;
}
};
9. What is an object-oriented model?
An object-oriented model is a way to apply object-oriented concepts to all the stages of the software development cycle. In an object-oriented model, we think about the problems using models organized around real-world problems.
The main objective of the object-oriented model is the following:
- Testing an entity before actually starting building it.
- Coordination with the customers.
- Visualization.
- Reducing complexity that leads to scalable products.
10. Differentiate between thread and process?
Thread | Process |
---|---|
Thread is the segment of a process. | A program into execution is known as a process. |
Thread generally takes less time to get complete. | The process takes a long time to get complete. |
It takes less time while context switching. | It takes more time while context switching. |
Thread shares memory. | Process is isolated. |
Less time is required for its creation. | More time is required for its creation. |
11. What is inheritance? Also, discuss various types of inheritance?
In the context of a class, inheritance is the capability of a class to inherit the properties and characteristics of another class. Inheritance is considered one of the most important concepts of Object-Oriented Programming (OOPS).
In this process, new classes are created from the existing class. The new class created is known as the derived class and the existing class is known as the parent class or base class.
Types of Inheritance:
- Single inheritance: In this type of inheritance only one class is allowed to inherit from one class. In other words, we can say that one derived class is inherited from the base class.
- Multiple inheritances: In multiple inheritances, a class is allowed to inherit from more than one base class. Some languages, like C++, support multiple inheritances but other languages like Java don’t. Though, in Java, we can achieve multiple inheritances through an interface.
- Multilevel inheritance: In multilevel inheritance, a derived class inherits another derived class.
- Hierarchical inheritance: In this type of inheritance, more than one derived class are inherited from a common base class.
- Hybrid inheritance: Hybrid inheritance is also known as virtual inheritance. It is a combination of more than one inheritance. For example, we can combine hierarchical inheritance and multiple inheritances.
12. Differentiate between multitasking and multithreading?
Multitasking | Multithreading |
---|---|
In multitasking, the CPU can form more than one task. | In multithreading, a process is divided into many sections and each section is allowed to run concurrently. |
In multitasking, processes do not share resources. | In multithreading, different threads share the same resource. |
Termination of the process takes more time. | Termination of thread takes less time. |
It helps in the development of efficient programs. | It helps in the development of an efficient operating system. |
13. How is a method is different from a constructor?
Method | Constructor |
---|---|
Method is used to depict the functionality of an object. | A constructor is used to initialize an object. |
Methods are invoked explicitly. | Constructors are invoked implicitly. |
The method must contain a return type. | Constructors don’t contain any return type. |
If a method is not specified by the user, no default method is provided. | If a constructor is not specified by the user then in that case default constructor is provided by the compiler. |
14. What is a deadlock and discuss the necessary conditions for deadlock?
Deadlock is a situation in which two or more processes wait for each other to get complete but none of them can ever complete (More specifically, they wait for the resources being held by the other).
Let us consider a scenario in which there are three different resources Resource1, Resource2, and Resource3, and three different processes Process1, Process2, and Process3. Resource1 is allocated to Process1, Resource2 is allocated to Process2, and Resource3 is allocated to Process3. After some time, Process1 asks for Resource1 that is being used by Process2. Process1 stops or halts its execution as it cannot be completed without Resource2. Process2 also demands Resource3 which is being used by Process3. Likewise, Process1 and Process2 also halt their execution because they cannot continue without Resource3. Process3 also asks for Resource1 which is used by Process1. Eventually, Process3 also halts its execution.
The four necessary conditions for deadlock are listed below:
- Mutual Exclusion: It states that a resource can be used in a mutually exclusive manner. It means that two or more two processes cannot share a resource at the same time.
- Hold and Wait: A process holds for a resource (that is being held by another process) while holding another resource.
- No preemption: A process cannot release a resource until it gets completed.
- Circular wait: It is a logical extension of hold and wait. It states that all the processes are arranged in a cyclic manner. Each process in the circular list waits for the resource being held by the next immediate process.
For example, if P[i] is the process and there are N number of processes in total, then the P[i] process waits for the resource allocated to the P[i] % (N + 1) process.
15. Differentiate between abstract class and interface.
Abstract Class | Interface |
---|---|
Abstract class can contain abstract as well as non-abstract methods. | Interface can contain abstract methods only. After, Java 8 is allowed to have default and static members also. |
Multiple inheritance is not achievable through the abstract class. | The interface supports multiple inheritances. |
An abstract class can contain final, non-final, static and non-static variables. | The interface can contain only static and final variables. |
An abstract class can be used to provide the implementation of the interface. | Interface can't provide the implementation of an abstract class. |
Frequently Asked Questions
1. Do interns get paid at JP Morgan?
Yes, JP Morgan pays well to their interns. The average stipend is around Rs. 6,48,053 per year.
2. What is the eligibility criteria at JP Morgan’s?
The eligibility criteria for software developer roles are given below:
- BS/BA degree or equivalent experience.
- Proficiency in one or more modern programming languages.
- Advanced knowledge of application, data, and infrastructure architecture disciplines.
- Understanding of software skills such as business analysis, development, maintenance, and software improvement.
- Understanding of architecture and design across all systems Working proficiency in developmental toolsets Knowledge of industry-wide technology trends and best practices.
3. What is your biggest failure in your life and how did you handle it?
This is the most frequently asked question in a HR interview. Such types of questions are asked in an interview to assess the honesty and attitude of the candidate. You have to be careful while sharing the incident you choose to explain. The mistakes that resulted in huge losses must be avoided. After sharing the incident, also share the lesson you learnt from it.
For example,
“I was managing a project and the senior authority wanted me to complete the project within two weeks. Since I was quite excited about the project so I decided to take up the project. But the project took more than two weeks time.
After this incident, I always analyze the project first and if I think I need more time for the project to be done, I simply ask them to impart me more time.”
4. What is a HireVue interview?
After clearing the online assessment round, candidates are required to go through a HireVue interview. HireVue is a kind of software that assesses the candidate on the basis of the traits like body language, eye movement, and more. If you are applying for a software engineer role then you should prepare JP Morgan interview questions to clear this round.
5. How much time does JP Morgan take to declare the result?
JP Morgan takes around 3 weeks to declare the final result.
6. How long is the JP Morgan interview process?
It is a fairly long process. Generally, it consists of three rounds but this process can take up to 2 months.
7. Is it hard to get into JP Morgan?
One needs a proper preparation strategy and then anyone can make it to J.P. Morgan easily. To crack interviews you must prepare the following topics thoroughly:
To ace Online assessment and technical interview rounds:
Data Structures and Algorithms:
- Linked lists
- Recursion
- Dynamic Programming
- Sorting algorithms.
DBMS:
- This is the most asked topic after data structure and algorithms.
- Generally, keys and normalization concepts are asked from this subject.
Operating System:
- You must have a good knowledge of how the CPU schedules different tasks in our system.
- Generally, questions from deadlock are asked in the interview.
8. Why do you want to join JP Morgan?
While answering these types of questions, mention the company's work culture that inspires you to join the company. Also, tell them about your goals to learn new things while working at the company.
For example,
You can say, “I am a determined person and want to work for an organization where I would get the opportunity to work on challenging problems. JP Morgan has a set of principles that are quite impressive. The principles will help me to improve and grow at the same time.”
9. What makes you a good fit for the job?
To answer such questions, you must highlight what makes you stand out and why the interviewer should be excited to have you on their team. Speak aloud about what you are good at, and the things you have done in the past that demonstrate your strength and abilities.