US President Barack Obama has urged young people to "reject pessimism and cynicism" and "know that progress is possible and problems can be solved".