You are here

COSC 1P02 Midterm Math Exercise

Completing the following math exercises will quicken your solutions to turtle graphics questions on your first test if they appear. Do without a calculator as you won't have one during your test. Check with a friend to see if you get the same answer.

1) Convert the following decimal to the smallest fraction representation, e.g. 3.25 = 13/4.
Which relationships develop?
 
 .25  .33  .50  .66
 .75  1.25  1.33  1.50
 1.66  1.75  2.25  2.33
 

2) Convert the following fractions of PI to degrees, e.g. 13/4pi = 225 degrees.
 
1/4π 7/4π 2/3π 11/4π
7/3π 5/3π 10/3π 5/2π
15/4π 3/2π 11/3π 7/2π

 
3) Find the final value of "number" when the for loops have completed all cycles.
 

int i;
int j;
int number;
number = 0;
for (i=0; i<=10; i++) {
     for (j=5; j<=13; j++) {
          number = number + 1;
     }
}

 

4) Find the final value of "number" when the for loops have completed all cycles.
 

int i;
int j;
int number;
number = 123;
for (i=4; i<8; i++) {
     for(j=10; j>7; j--) {
          number = number - 1;
     }
}