Preskoči na glavni sadržaj
Prijava
Sign up for FREE
arrow_back
Biblioteka

Arrays Quiz

star
star
star
star
star
Posljednje ažuriranje about 2 years ago
11
8
8
8
8
8
8
8
8
8
8
20
Pitanje 1
1.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println( array[0] );

Pitanje 2
2.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println( array[1] );

Pitanje 3
3.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println( array[5/2] );

Pitanje 4
4.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println(array[array.length-1]);

Pitanje 5
5.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println(array[array.length]);

Pitanje 6
6.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println(array.length);

Pitanje 7
7.

What is output by the code below?

int[] array = {5,7,8,11,4};

for(int i=0; i<array.length/2; i=i+2)

{

array[i]=array[array.length-i-1];

}

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

Pitanje 8
8.

What is output by the code below?

int[] array = {5,7,8,11,4};

out.println(array[7/2]);

Pitanje 9
9.

What is output by the code below?

int[] nums = new int[10];

for (int i=0; i < nums.length; i++)

{

nums[i] = i*2;

}

System.out.println(nums[5]);

Pitanje 10
10.

What is output by the code below?

int[] array = {5,7,8,11,4};

int sum = 0;

for(int i = 0; i<array.length; i++)

sum = sum + array[i];

System.out.println(sum);

Pitanje 11
11.

Write a return method named run that returns an integer. run takes in one parameter which is an array of integers named one. run will return the sum of all values greater than 5 in the array one . The call run([3,4,5,6,7,8,9]) would return 30. Type your answer in the show your work box.