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

A few questions for my take-home quize. 14) Analyze the following code. int[ ] l

ID: 3568660 • Letter: A

Question

A few questions for my take-home quize.

14) Analyze the following code.
int[ ] list = new int[5]; list = new int[6];

A) The code can compile and run fine. The second line assigns a new array to list.

B) The code has compile errors because you cannot assign a different size array to list.

C) The code has runtime errors because the variable list cannot be changed once it is assigned.

D) The code has compile errors because the variable list cannot be changed once it is assigned.

20) Which of the following statements are true?

A) If a file (e.g., c: emp.txt) does not exist, new File("c:\temp.txt") creates a new file named
c: emp.txt.

B) If a directory (e.g., c:liang) does not exist, new File("c:liang") creates a new directory named
c:liang.

C) If a directory (e.g., c:liang) does not exist, new File("c:liang") returns null.

D) If a file (e.g., c: emp.txt) does not exist, new File("c:\temp.txt") returns null.

E) None of the above.

32) Assume StringBuilder strBuf is "ABCDEFG", after invoking ________, strBuf contains
"ABCRRRRDEFG".

A) strBuf.insert(3, "RRRR")

B) strBuf.insert(2, "RRRR")

C) strBuf.insert(1, "RRRR")

D) strBuf.insert(4, "RRRR")

39) Which of the following statements are true? (Choose all that apply.)

A) If a method overrides another method, these two methods must have the same signature.

B) A method can be overridden in the same class.

C) A method can be overloaded in the same class.

D) If a method overloads another method, these two methods must have the same signature.

Explanation / Answer

14)
int[ ] list = new int[5]; list = new int[6];
A) The code can compile and run fine. The second line assigns a new array to list.

20)
E) None of the above.

32)
A) strBuf.insert(3, "RRRR")

39)
A) If a method overrides another method, these two methods must have the same signature.
C) A method can be overloaded in the same class.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote