0
0
Javaprogramming~15 mins

Why arrays are needed in Java - Test Your Understanding

Choose your learning style8 modes available
ads_clickPractice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare an array of integers named numbers.

Java
int[] [1] = new int[5];
🎯 Drag options to blanks, or click blank then click option
Avalues
BnumList
Cnumbers
Darray
Attempts:
3 left
2fill in blank
medium

Complete the code to assign the value 10 to the first element of the array.

Java
numbers[[1]] = 10;
🎯 Drag options to blanks, or click blank then click option
A1
B0
C5
D-1
Attempts:
3 left
3fill in blank
hard

Fix the error in the code to print the length of the array.

Java
System.out.println(numbers[1]);
🎯 Drag options to blanks, or click blank then click option
A.length
B.length()
C.size()
D.count
Attempts:
3 left
4fill in blank
hard

Fill both blanks to create an array of 3 strings and assign "apple" to the first element.

Java
String[] [1] = new String[[2]];
[1][0] = "apple";
🎯 Drag options to blanks, or click blank then click option
Afruits
B3
C5
Ditems
Attempts:
3 left
5fill in blank
hard

Fill all three blanks to create an array of integers, assign 5 to the second element, and print it.

Java
int[] [1] = new int[[2]];
[1][1] = [3];
System.out.println([1][1]);
🎯 Drag options to blanks, or click blank then click option
Ascores
B4
C5
Dvalues
Attempts:
3 left