Analyze the following code:

```

public class Test {
public static void main(String[] args) {
int[] a = new int[4];
a[1] = 1;
a = new int[2];
System.out.println("a[1] is " + a[1]);
}
}
```
a. The program has a compile error because new int[2] is assigned to a.
b. The program has a runtime error because a[1] is not initialized.
c. The program displays a[1] is 0.
d. The program displays a[1] is 1.


c. The program displays a[1] is 0.
After executing the statement a = new int[2], a refers to int[2]. The default value for a[0] and a[1] is 0.

Computer Science & Information Technology

You might also like to view...

Use commands on the ____ tab to align a report's labels with their text boxes.

A. Standard B. Formatting C. Toolbox D. Arrange

Computer Science & Information Technology

A newly appointed risk management director for the IT department at your company, a major automobile parts manufacturer, needs to conduct a risk analysis for a new system which the developers plan to bring on-line in three weeks. The director begins by reviewing a thorough and well-written security assessment of the system. The report lists a manageable volume of infrequently exploited security

vulnerabilities. The likelihood of a malicious attacker exploiting one of the vulnerabilities is low; however, the director still has some reservations about approving the system. What is a valid reason behind the reservations he has? A. Government regulations prevent the director from approving a system with vulnerabilities. B. The resulting impact of even one attack being realized might cripple the company financially. C. The director is being rushed to approve a project before an adequate assessment has been performed. D. The director should be uncomfortable accepting any security vulnerabilities and should find time to correct them before the system is deployed.

Computer Science & Information Technology

To change the length of the tracking log history, specify a new length in _______ on the Advanced tab in the Share Workbook dialog box.

A. months B. days C. years D. hours

Computer Science & Information Technology

Use the ________ to edit, delete and create range names.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology