The official policy is:
-You can retake any course in which you got a C- or lower (though keep in mind, anything at or above D- IS passing.. but some courses either recommend or require at least a C- in it's prereqs..)
-For better or for worse, the 2nd grade is the one that counts (both will still appear on your transcript, but there will be a note after the first one saying it has been retaken, and it would not count in your GPA calculations)
-You may retake up to 16 units of work before all of your grades count towards your GPA (that is.. once you used up your 16 units, and you repeat another class, the previous grade and your new grade will both count in your GPA calculations)
-You may only retake the same class once. Afterwards, all of the grades will count. (for example.. you first get a C-, then you get a F, and then you get an A. Your GPA from this course would be 2.0 from the F and the A)
-If you advance in the course's tree, you can not go back and retake a previous class. (for example.. math 31A you get a D, math 31B you have a life changing experience and get an A. Now you want to go back and fix that grade in Math 31A. Too bad... it would say unauthorized repeat and you would get no credit at all for it)
Point #2: Always try to pass the class on the first try. Grad schools DO NOT like to see you giving up for any reason.. even if just to try again next year. There's few second chances in real life.
FYI.. this is my first post here.. i decided to finally bite because i've been reading some posts. Next time you have question, you kids should really consider talking to someone who's been trained in these kinds of stuff. If not your real academic counselor, then contact a peer counselor or even your old orientation counselor (if you went to orientation). These people know the rules inside out, and it's way more reliable then trusting random faces of the internet.