1.Suppose a method is declared as:

```
public static void f (double d, int n) {
....;
}
```

Which one of the follow method invocations would compile with no errors?

Select one:

a. f(2.5, 3.5);

b. f(2, 3);

c. f(2.5);

d. f(3);

I chose b

2.Each of the following pieces of information is spelled out by the header of a method. Which one is of no importance to a caller of the method?

Select one:

a. The names of the formal parameters

b. The types of the parameters the method takes

c. The type of value returned by the method, if any

d. The number of parameters the method takes

e. The name of the method

I chose b

3.Consider this method:

```
public static int f (int a, int b, int c) {
return (a+b+c)/3;
}
```

What is the value of the expression f(1,2,3)?

I got 2.

4.How many parameters does the Math.copySign method take? (Feel free to browse the documentation to find the answer.)

Select one:

a. 0

b. 3

c. 2

d. 1

I chose c

5.If a method is invoked as s.m(3) and s is an object, then m is a static method.

Select one:

True

False

I chose true

6.How many times will the loop execute its body?

```
int x = 1;
while (x < 100) {
System.out.println(x + " ");
x += 10;
}
```

Select one:

a. 11

b. 10

c. 8

d. 9

I chose d

7.How many times will the loop execute its body?

```
int x = 10;
while (x % 3 != 0) {
System.out.println(x);
}
```

Select one:

a. more than a billion

b. 9

c. 0

d. 10

I chose a.

8.How many times will the loop execute its body?

```
String word = "a";
while (word.length() < 10) {
word = "b" + word + "b";
}
```

Select one:

a. 0

b. 7

c. 5

d. 6

I chose b

9.How many times will the loop execute its body?

```
int x = 20;
while (x > 0) {
System.out.println(x/10);
x = x / 2;
}
```

Select one:

a. 5

b. 2

c. more than a billion

d. 10

I chose b

10.Which of the following statements is false?

Select one:

a. A formal parameter is a variable

b. An actual parameter is an expression

c. The number of actual parameters must equal the number of formal parameters

d. The variables used as actual parameters must have the same names as the The variables used as actual parameters must have the same names as the variables used as formal parameters

I chose c