Question: 1) How many times is the println statement executed? for ( int i=0; i <5; i++ ) { for ( int j=0; j

1) How many times is the println statement executed?

for ( int i=0; i<5; i++ ) { for ( int j=0; j 

2)

The proper way to re-write the following code using the short handed method is:

count = count + 25;

3)

What modifier do we add to the instance variable name to make it hidden?

public class Player { _______________ String name; public Player() { this.name = ""; } public void setName( String newName ) { this.name = newName; } public String getName() { return this.name; } }

4)

Match the following symbols with their purpose.

Arrays

[ Choose ] {} [] () "" ''

Blocks

[ Choose ] {} [] () "" ''

Precedence

[ Choose ] {} [] () "" ''

Strings

[ Choose ] {} [] () "" ''

Characters

5)

Consider the following code:

int[][] form = new int[2][5]; for ( int i=0; i<2; i++ ) { for ( int j=0; j<5; j++ ) { form[i][j] = i+4*j; } }

Match the indices of the array to the answers provided

form[0][1]

[ Choose ] 5 13 4 invalid 8

form[1][1]

[ Choose ] 5 13 4 invalid 8

form[2][4]

[ Choose ] 5 13 4 invalid 8

form[0][2]

[ Choose ] 5 13 4 invalid 8

form[1][3]

6)

The following code compiles correctly but creates a run-time error, correct the code so it runs correctly.

int[] b = new int[10]; int i; for ( i=1; i<=b.length; i++ ) { b[i] = 5 * i; } 

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!