How to handle multiple years lost to test preparation on CV? In 2011, I passed the Master's degree in mathematics with more than 80 percentile. I had a dream of becoming a research scholar in one of country's reputable mathematical institutes.

However, here in India, PhD candidates have to pass a test called National Eligibility Test before facing the interview board of such institutes. To prepare for the test, I disconnected myself from the outer world. Unfortunately, I failed the first three times but managed to pass the test in my fourth attempt, and subsequently joined the institute of my dream for PhD in 2013.

Because I didn't do anything other than preparing for the test, I have a hard time filling the 2-year gap in my CV. Whenever I look at it, that 2-year void pains me as most of my fellow scholars can show an uninterrupted career path on their CVs. I do understand myself that my mathematical knowledge grew in that two years, still I can't find a single demonstrable item to support my case.

Most people either clear the national test in the first or second try, and most of the rest would choose to leave the field forever, or get involved in guest lectureship in some institutes while preparing for the test. For me, however, I found it hard to make the time for anything else on top of studying, and hence I did nothing else. Now, I really wish to have such examples in my CV.

My question: have you lost many years in order to prepare for tests or exams? If so, can you suggest some examples on how to explain that lost time?
I agree with @socialsciencedoc's comment, although I think that what s/he describes is a more common phenomenon in the social sciences than in STEM fields.  In the former, it's rare to be a 20-something PhD, and in the latter it most certainly isn't: not getting your PhD in math until you're 30 makes you (slightly, and certainly inessentially) older than average.

Anyway, I am not really scrutinizing gaps in candidates CVs until after their PhD (at which point I am!).  Having a gap between undergrad and grad is still very common in STEM fields: e.g. many people do a couple years of high school teaching before the siren song of academia lures them back.  One of my current PhD students did some high school teaching (among other things...) and will be over 30 when he gets his PhD.  In his case, he acquired some skills in his "gap years" that are proving useful to him as a student and future mathematician.

Spending multiple years only studying for an exam is not something that most Western academics would be so familiar with, I'm afraid.  I'm not sure how to spin that positively.  So I would just not explain the gap at all.  Put your energy into what you can now control: getting a PhD in a timely manner (in math, four or five years is ideal; six is still totally fine; after that it begins to look like you lack sufficient locomotion) and, of course, proving some great theorems in your thesis work.  My eye would probably slide right over this gap in your CV...and I think that is exactly the way you want it.

Added: I missed this sentence reading your question the first time: " I do understand myself that my mathematical knowledge grew in that two years, still I can't find a single demonstrable item to support my case."  That's great; truly.  So your time was actually well spent, and I'm very glad to hear that.  You don't have to further justify that that time was well spent: it got you into the great university that you now attend.  So I think you have little to worry about, actually.