The correct option is B Protects the bacterial DNA against foreign DNA
Restriction endonuclease enzyme cleaves DNA at specific sites along the molecule. In the bacterial cell, restriction enzymes cleave foreign DNA, thus eliminating infecting organisms. The restriction enzyme prevents replication of the bacteriophage DNA by cutting it into many pieces. This is the reason they are an important tool of recombinant DNA technology (genetic engineering).
So, the main function of restriction endonuclease enzyme is to protect the bacterial DNA against foreign DNA.