This question is extracted from SQL Server interview question book by Shivprasad koirala , click here to know about SQL Server interview question book
Both these files are found in “C:\Program Files\Microsoft SQL Server\MSSQLX.MSSQLSERVER\MSSQL\DATA”. Please note to replace X with 10 for 2008 and 11 for 2012.
MDF file is the primary database file where the actual user data and schema gets stored. In other words table data, table structure, stored procedures, views and all SQL Server objects gets stored in to this file.
LDF file is a transaction log file to store transaction logs. They do not have the actual user data or schema definition. Every MDF will have associated LDF. While recovering the database it’s always advisable to keep the LDF so that you do not lose any transaction information.
See this mind blowing SQL Server interview question video: – What are inner joins left join and right join?
Do not forget to look in to .NET, c#, SQL Server video product SQL Server interview questions
Regards,
Click to view more from author’s on SQL Server Interview question

The only thing I would add is that the very well qualified person will know that the extension is meaningless, but only a basic convention (and what an .NDF probably is
)