Take my advice with careful consideration, seeing as I am a high schooler myself (senior) and not a counselor or anything like that.
You have three more years ahead of you, and if your current academic situation is a result of a failure to understand material rather than just a need to adapt to a high school setting, things will not get any easier, especially around junior year, when the most competitive students will have extremely rigorous schedules with close to all, if not all, college-level courses (AP, DE, IB, and AICE). I have seen several of my friends experience disappointing drops in GPA as course rigor increases. Your goal of a 4.0 or above will be essentially impossible to obtain if you continue to receive poor grades as you have done right now.
Even after taking this into consideration, if you are flat out failing Algebra 2, you should not continue on your advanced math track, which generally includes Pre-Calculus H in 10th and AP Calculus in 11th. As DadTwoGirls said, math concepts build on each other; if you fail to learn a newly-taught concept, you can’t just shrug your shoulders after bombing the chapter test and hope that the new chapter is easier because the material doesn’t go away; in fact, it follows you throughout the rest of the course you are in AND every successive course in your math sequence. If you are totally unable to handle or understand the material you are learning right now to the point where you are at risk of failing the entire course, it would be extremely self-destructive to willingly expose yourself to successive courses that build off of the material you are learning now and happen to be even more complex, assuming the school lets you take them. I am saying this not to be mean-spirited, but out of concern that you will dig yourself deeper into a hole than you already have.
I used to blank out on tests and not do as well as I would like to, and I’ve found that doing practice problems over and over and over again helps tremendously, both by providing exposure to the material AND reducing anxiety, especially on the morning of the exam. Be sure you know every type of problem that will be on an exam and that you do each of those; one time, I reviewed all but one section of a chapter that we were going to be tested on, and lo and behold, I got every single problem based on the sections I reviewed right and every single problem on the section I did not review wrong. By the way, I used all of these tips for my own Algebra 2 Honors class and my College Algebra class (which covers very similar material).
If I were you, I would try to get my affairs in order to the best of my ability this quarter in attempt to produce decent semester grades, although your chances of obtaining strong semester grades in your courses may be extremely low due to your apparently “iffy” first quarter grades (especially Algebra 2; assuming your grading scale is <60 is an F, even if you earn a perfect 100 for your quarter 2 average, your grade will not average out to be anything more than a C+).