Computer
Science 2610
Spring
2000
Quiz
1
(a) why the function was written.
(b) where the parameters will come from.
(c) what the functions parameters mean to what the function computes.
(d) the purposes of the local variables.
(a) doing so makes it possible to avoid using global variables.
(b) doing so makes the program easier to write.
(c) doing so makes the program run much faster.
(d) doing so makes the program more confusing.
(a) char
(b) double
(c) long
(d) function
(a) 0
(b) 1
(c) 2
(d) 9
void
four()
{
int k = 9;
while(k != 1) {
if(k % 2 == 0) k = k / 2;
else k = 3*k + 1;
}
cout << k << endl;
}
(a) 4
(b) 5
(c) 16
(d) 65
void
five()
{
int i,k;
i = 1;
k = 1;
while(i < 4) {
k = k * i + 1;
i++;
}
cout << k << endl;
}
void
six()
{
int x,y,z,w,b;
x = 90;
y = x x / 2;
z = x / 4;
w = x % 4;
b = y > x;
cout << x = << x << y = << y
<< z = << z
<< w = << w <<
b = << b << endl;
}
double average(double x, double y)
{