CS 2401 Quiz #1

Date: Monday, January 24, 2011.

1. What will be the printed as a result of the following code:

  double [] a = {0.5, 1.0};
  int [] b = new int [2];
  b = a;
  b[1] = b[0];
  System.out.println(a[1]);
Explain your answer

2. Which university has the largest number of students? Let us assume that the number of students in different universities is given in an array s[i]. Write down a piece of code for finding the university which has the largest number of students. Trace this code on the example of an array consisting of numbers 8,000, 22,000, and 15,000. Question: which of these three universities is UTEP?