Question d’entretien chez JPMorganChase

talking about java programing language : 1, what is OOP? 2. what all the data structure in java? 3. what is deadlock? how to fix it?

Réponse à la question d'entretien

Utilisateur anonyme

28 févr. 2020

1. Object Oriented Programming is an approach which uses Objects. Objects contain methods (procedures) and attributes/data (fields etc). These methods "operate" on the data included in the object. OOP is a much more efficient approach to programming than procedural programming. 2. Java contains an interface called Collections which is extended by the following interfaces: List, Queue, Set, Dequeue. From these interfaces, you have classes which implement them such as: ArrayList, LinkedList, Vector, Stack, PriorityQueue, HashSet, TreeSet, HashMap etc.. 3. A deadlock arises when these 4 conditions occur simultaneously: 1. Mutual Exclusion: Only one process at a time can use a resource. 2. Hold and Wait: A process holding at least one resource is waiting to acquire additional resources being used by another process. 3. No Reemption: A resource is relased voluntarily by the process holding it, after completing the task. 4. Circular Wait: Process 0 is waiting for a resource being held by Process 1, Process 1 is waiting for a resource being held by Process 2 and so on.. The way to solve deadlocks is by deadlock prevention and deadlock avoidance such as: using locks, declaring the maximum amount of resources a process can use, declaring which process has priority over others, ensuring a process can not request more resources until it has released unused resources among many other solutions.

1