I know it comes by practice; my teacher said this. But I want exercises for this, so that I will come to know which note or scale is being played.
Where should I start from?
What I'd suggest is to pick up your instrument (any instrument) and play a scale and sing it. Because when you simply play a scale, you'll simply listen to it. But when you sing it, you'll relate the sound you are hearing with the notes.
After you've done that, play the scale up and down moving in thirds, then in fourths, fifths etc.
( E.g the C major scale moving up in thirds would be C-E, D-F, E-G etc)
This way you'll be able to hear all the intervals included in the scale as well. Again, you won't simply be listening to the intervals, you'll be able to relate what you theoretically know with what you play.
This has helped me a lot in my ear training.
I break down ear training into three things:
Identify the intervals. There's the eight we're used to hearing most of the time, as well as the extended intervals. Work on the ones inside the octave first, then venture out above the octave. The easiest way to start recognizing intervals is to associate them with melodies or intervals you encounter in real life. This includes the beginning of the Star Wars theme or "Here Comes the Bride", etc. Here's a great reference to associations to get you started. Most intervals we here are going up, so start with intervals ascending. Once you feel comfortable with that, try them going down. Then check out the intervals above an octave.
This is just like a language. Repetition is key.
When working on scales you have three you'll hear often; major, minor and melodic minor. You may even encounter others, especially if you're venturing into jazz. Start small and listen to the scale ascending and descending (I'm looking at you, melodic minor!) because it can change slightly. Once you feel comfortable identifying the standards, venture to pentatonics, altered scales, and non-western scales. It's fun!
Chords are similar to scales in that you have a few staples you need to be able to recognize before moving on to more advanced stuff. Focus on types (Major, Minor, Augmented and Diminished) of triads just getting the basics. Once you feel comfortable with those start expanding the chord extensions. Start to recognize the same 4 with 7ths, then 9ths, then 11ths, then 13ths. After you get there (be sure to listen to what's on top of the triad) you can start to take a look at altered chords including 6/9, sus4, etc.
Practice all of these with - and away from - your primary instrument. And don't focus on a key center, try to be as abstract and random with your interval/chord/scale keys as possible. This makes you focus on the note relationships and not diatonic analysis. There's associations you'll subconsciously make with the instrument you play and these intervals, but the retention rate skyrockets when you can do this away from the instrument and work on you "inner ear".
The key when working on this is again repetition. If you don't use it you'll lose it. if you do it enough it'll become second nature and you'll be able to understand and speak a completely different language with fluency. As you move along, try to analyse the stuff you hear, intervals in nature, or chords, or scales are everywhere. Try to identify what you hear, then use handy mobile tools (see below) to check your answers. For grins, try to recognize pitches away from an instrument as well. You'll start to notice a lot of environment sounds revolve around standard pitches and intervals.
All three of these things can easily be practice with mobile applications (you always have a phone, tablet or music player on you most of the time). My particular favorite (though entirely opinionated) is Tenuto. It's available on mobile devices as well as the browser and comes from the good people at musictheory.net
my suggests :