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

2. Answer A. The Java Runtime System forbid continuation. B. The method\'s runni

ID: 3543395 • Letter: 2

Question

2.

Answer

A. The Java Runtime System forbid continuation. B. The method's running time has become exponential (or worse). C. The method's memory requires have become exponential (or worse).

2.

Is it possible for a method of a class to activate another method of the same class?

Answer

A. No. B. Yes, but only public methods. C. Yes, but only private methods. D. Yes, both public and private methods can be activated within another method. 3. Consider the following statements:

  int[ ] p = new int[100];
int[ ] s = (int[ ]) p.clone( );

After these statements, which of the following statements will change the last value of p to 75?


Answer A. p[99] = 75; B. p[100] = 75; C. s[99] = 75; D. s[100] = 75; E. Two or more of the answers will change i to 75. D. The method is no longer guaranteed to make the postcondition true.

Explanation / Answer

1.      When the precondition fails, an exception is thrown, that will halt the program as the method is no longer guaranteed to make the post condition true.

Hence option D is correct.

2.      Yes, both public and private methods can be activated within another method.

Because member functions are part of the class, they can access both public and private functions. Hence option D is correct.

3.      P[100]=75; and s[99]=75 are correct. The clone created also access the same part of memory as that of p.

Hence option E is correct.