Solution 1

Aniket Kumar
4 min readMay 23, 2020

--

1 →HTTP means HyperText Transfer Protocol. HTTP is the underlying protocol used by the World Wide Web and this protocol defines how messages are formatted and transmitted, and what actions Web servers and browsers should take in response to various commands

GET-The GET method is used to retrieve information from the given server using a given URI. Requests using GET should only retrieve data and should have no other effect on the data.

HEAD-Same as GET, but transfers the status line and header section only.

POST-A POST request is used to send data to the server, for example, customer information, file upload, etc. using HTML forms.

PUT-Replaces all current representations of the target resource with the uploaded content.

DELETE-Removes all current representations of the target resource given by a URI.

CONNECT-Establishes a tunnel to the server identified by a given URI.

OPTIONS-Describes the communication options for the target resource.

TRACE-Performs a message loop-back test along the path to the target resource.

2 →Understanding the ACID and BASE

ACID and BASE properties are used for Database Transaction.

Acid guarantee is that it provides safe environment in which to operate on your data.
ACID stands for Atomic, Consistent, Isolated and Durable

Atomic means every transaction succeeds or the entire transaction is rolled back

Consistent-On the completion of a transaction, the database is structurally sound. A transaction cannot the leave the database in an inconsistent state.

Isolated- Transaction cannot leave the database in an inconsistent state.

Durable-The results of applying a transaction are permanent, even in the presence of failures.

ACID properties mean that once a transaction is complete, its data is consistent and stable on disk, which may involve multiple distinct memory locations.

Understanding BASE Property
Basic Availabilty- The database appears to work most of the time.
Soft-state- Stores don’t have to be write-consistent, nor do different different replicas have to be mutually consistent all the time.

Eventual Consistency- Stores exhibit consistency at some later point.

Here’s another way to understand
he CAP theorem states that a distributed computer system cannot guarantee all of the following three properties at the same time:

  • Consistency
  • Availability
  • Partition tolerance

A BASE system gives up on consistency.

  • Basically available indicates that the system does guarantee availability, in terms of the CAP theorem.
  • Soft state indicates that the state of the system may change over time, even without input. This is because of the eventual consistency model.
  • Eventual consistency indicates that the system will become consistent over time, given that the system doesn’t receive input during that time.

A BASE data store values availability (since that’s important for scale), but it doesn’t offer guaranteed consistency of replicated data at write time.
Base

It is an alternative to ACID.

3 → Inheritance is a relation between two classes where one class inherits the properties of the other class.

public class extends B{}

Java does not support multiple inheritance.

public class abstract sample
{
public abstract demo();
}

In the same package, we have two classess extending the above class and trying to implement its abstract method.

public class super1 extends sample{
public void demo()
{
System.out.println("demo method of super1");}}
public class super2 extends sample{
public void demo()
{
System.out.println("demo method of super1");}}
public class subclass extends super1 , super2{
public static void main(String args[])
{
subclass obj=new subclass();
}}

Thus, as per the basic rule of inheritance, a copy of both demo() methods should be created in the subclass object which leaves the subclass with two methods with same prototype.
If you call the demo() method using the object of the subclass of the subclass compiler faces an ambiguous situation not knowing which method to call.
This issue is called Diamond Problem.

You can achieve multiple inheritance in Java, using the default methods (Java8) and interfaces.

4 → We have limited number of resources which are to be shared among multiple processes. When one process waits for resources which are held by another process which in turn is waiting for another process to release the resources then such a condition is called DEADLOCK.

A deadlock occurs if following four conditions hold simultaneously:

1. mutual exclusion

2. Hold and wait

3. No Preemption

5. Circular Wait.

We can prevent deadlock by preventing an

A set of processes is in a deadlocked state when every process in the set is waiting for resource(s) that is held by another process in the set.

A deadlock occurs if following four conditions hold simultaneously:

1. mutual exclusion

2. Hold and wait

3. No Preemption

4. Circular Wait.

There are three ways to handle deadlock
1) Deadlock prevention or avoidance: The idea is to not let the system into deadlock state.

2) Deadlock detection and recovery: Let deadlock occur, then do preemption to handle it once occurred.

3) Ignore the problem all together: If deadlock is very rare, then let it happen and reboot the system. This is the approach that both Windows and UNIX take.

In deadlock prevention, we ensure that atleast one of the necessary conditions cannot hold.

In deadlock avoidance, we require additional information about how resources are to be requested.We can avoid deadlock by using:-

1. For single instance of each resource type :-Resource-Allocation-Graph Algorithm

2. For multiple instances of resource types:-BANKER’S ALGORITHM

--

--

No responses yet