Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Suppose that a is declared as an int a[99]. Give the contents of the array af

ID: 3561924 • Letter: 1

Question

1. Suppose that a is declared as an int a[99]. Give the contents of the array after the following two statements are executed: for (i = 0; i <99 ; i++) a[i] = a[a[i]];

2. Prepare a program that counts the number of different integers less than 1000 that appear in an output stream.

3. Write a function that returns the number of nodes on a circular list, given a pointer to one of the nodes on the list

4. Write a function that moves the largest item on a given list to be the final node on the list

5. Give, in the same manner as Figure 4-2 of the text, the contents of the stack as the following expression is evaluated by Program 4.5.

6. Write a client that picks numbers for the lottery by putting the numbers 1 through 99 on a random queue, then prints the results of removing five of them.

Explanation / Answer

public static int random_7(Random rg) { int returnValue = 0; while (returnValue == 0) { for (int i = 1; i