A function is a named, independent section of code that performs a specific task and optionally returns a value. The key components of a function are the function header, return type, name, parameters, body, local variables, statements, and returning a value. Recursion refers to a function calling itself directly or indirectly. Exercises include creating programs that use functions to calculate the average of integers, display text a given number of times, calculate the factorial of a number recursively and non-recursively.