Name: ________________________________

Honor Code Acknowledgment: _____________________________


CPS 6, Summer 1999                 Random Quiz 10

Due: Tuesday, June 22, 1999                 8 points


Problem 1: Globalness (4 points)

What is the output of the following code that has global variables?
int A = 2;
int B = 3;

void SomeFun()
{
  int B = 9;
  while (B > 7)
  {
    int A = B;
    B--;
  }
  cout << A << " " << B << endl;
}

void MoreFun()
{
  int A = B;
  B = 6;
}

int main()
{
  cout << A << " " << B << endl;
  SomeFun();
  cout << A << " " << B << endl;
  A = 11;
  B = 12;
  MoreFun();
  cout << A << " " << B << endl;
}













Problem 2: Sorting (4 points)

Assume the following numbers are in an array.
     10  29  32  56  8
Show the resulting array after each pass of Selection Sort until the array is sorted.