Apexon interview question

How does rag works. Some basic questions on ML Write a code for binary search