QID interview question

What are the differences between stored procedure and function?