Practice Final



C Sc 227 Test 1, Section Leader __________ Your Name __________________________ 100pts

0. Today is the first day of Fall. Is it still hot enough for you? a) Yes b) No c) No opinion ____________ (2pts)

1. Write a checkmark √ to the right of any assertion in the following test method if it would pass. Leave the line in the comment blank if the assertion would fail. (16pts)

@Test

public void testExpressions() {

int j = 5;

int k = 9;

String s = "Kim";

assertEquals(0, k / j); // a. ______

assertEquals(5, j % k); // b. ______

assertEquals(5, k % j); // c. ______

assertEquals('i', s.charAt(2)); // d. ______

assertEquals(0, s.indexOf("Ki")); // e. ______

assertTrue(pareTo("Casey") > 0); // f. ______

assertTrue(pareTo("Kim") ................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download