Twa kɔ nsɛm atitiriw so
Log in
Sign up for FREE
arrow_back
Laabri

Array of Ref Test

star
star
star
star
star
Last updated about 2 years ago
12 Nsɛmmisa
5
5
5
5
5
5
5
5
5
5
Asemmisa {{asɛmmisaAhyɛnsode}}
1.

What is output by the code below?

String[] ray;

ray = new String[4];

System.out.println( ray[0] );

Asemmisa {{asɛmmisaAhyɛnsode}}
2.

What is output by the code below?

Integer[] ray;

ray = new Integer[4];

System.out.println( ray[3] );

Asemmisa {{asɛmmisaAhyɛnsode}}
3.

What is output by the code below?

Integer[] ray;

ray = new Integer[4];

ray[1] = null;

ray[0] = new Integer(3);

ray[2] = new Integer(99);

System.out.println( ray[2] );

Asemmisa {{asɛmmisaAhyɛnsode}}
4.

What is output by the code below?

Integer[] ray = {11,55,-4,909};

System.out.println( ray[3] );

Asemmisa {{asɛmmisaAhyɛnsode}}
5.

What is output by the code below?

Double[] ray = {11.2,55.0,-4.5,909.0};

System.out.println( ray[1] );

Asemmisa {{asɛmmisaAhyɛnsode}}
6.

What is output by the code below?

Double[] ray = {11.2,7.2,-4.5,909.0};

ray[1] = new Double(55.0);

System.out.println( ray[1] );

Asemmisa {{asɛmmisaAhyɛnsode}}
7.

What is output by the code below?

Double[] ray = {3.2,5.7,6.3,1.9};

double x = 0;

for( double r : ray )

x += r;

System.out.println( x );

Asemmisa {{asɛmmisaAhyɛnsode}}
8.

What is output by the code below?

Double[] ray = {3.1,5.2,6.3,1.4};

for( double r : ray )

r = 0;

System.out.println( ray[2] );

Asemmisa {{asɛmmisaAhyɛnsode}}
9.

What is output by the code below?

String[] ray;

ray = new String[4];

ray[1] = "one";

System.out.println( ray[1] );

Asemmisa {{asɛmmisaAhyɛnsode}}
10.

What is output by the code below?

String[] ray;

ray = new String[4];

ray[1] = "one";

ray[2] = "two";

ray[3] = "three";

System.out.println( ray[0] );

25
Asemmisa {{asɛmmisaAhyɛnsode}}
11.

Part A. Write the Group method howManyWithXVowels(), as started below.  howManyWithXVowels will receive an integer and determine if each word has more than that number of vowels.

If the list is ["about","dogs","123456","A"]

The call howManyWithXVowels( 1 ) would return 3

The call howManyWithXVowels( 3 ) would return 1

/**

Method howManyWithXVowels will return the number

of Words with at least x vowels

*/

public int howManyWithXVowels( int x )

{

//Code goes here//

}

25
Asemmisa {{asɛmmisaAhyɛnsode}}
12.

Part B. Write the Group method getTotalDigitCount( ), as started below.  getTotalDigitCount( ) will return the total number of digits in all of the words in the list.

If the list is ["abou7","dogs","123456","A","34Funny"]

The call getTotalDigitCount( ) would return 9

/*

Method getTotalDigitCount will return the count

Of the number of digits in all of the words in stuff

*/

public int getTotalDigitCount( )

{

//Code goes here//

}