homework in r language

I have a basic homework is needed to be solved in R. The questions will be provided when accepting the question.