Binary Search STL

Is binary_search() function present in every compiler ?
Can we use this in online tests of companies ?

Yes it present in almost every compiler. You can use in tests
Just don’t forget to include header files