Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete 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
Attempts:
3 left
2fill in blank
mediumComplete 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
Attempts:
3 left
3fill in blank
hardFix 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
Attempts:
3 left
4fill in blank
hardFill 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
Attempts:
3 left
5fill in blank
hardFill 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
Attempts:
3 left
