Cognizant interview question

1.Reverse a string 2.Write a swap function.