Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to declare an integer array named numbers with size 5.
Java
int[] numbers = new int[[1]];🎯 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 numbers.
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 numbers.
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 strings named fruits with 3 elements and assign "Apple" to the first element.
Java
String[] fruits = new String[[1]]; fruits[[2]] = "Apple";
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
5fill in blank
hardFill all three blanks to create an integer array named scores, assign 100 to the last element, and print it.
Java
int[] scores = new int[[1]]; scores[[2]] = 100; System.out.println(scores[3]);
🎯 Drag options to blanks, or click blank then click option
Attempts:
3 left
