Whether the two certificates are useful or not depends entirely on what you will do in the future, but it is better to take an exam. If you are good at computer science, it doesn't matter if you don't report to class. These two certificates are easy to pass. If your major is not computer, I suggest you go to class, because the teacher mainly teaches according to the content of the exam, and the subject will be more difficult to pass.
Anyway, it's easy to have a certificate in hand! Besides, universities have a lot of leisure time, so it is better to have a learning goal than to be bored.