This question was asked to me in an interview.
Suppose char *p=malloc(n) assigns more than n,say N bytes of memory are allocated and free(p) is used to free the memory a
This is the default behavior of malloc. It will return NULL
or a pointer to a section of memory at least as long as the one you asked for. So yes free must be able to handle getting rid of memory longer than what was asked for.
Finding out how much memory was actually free or allocated is a platform specific question.