Java From Beginner To Advanced

0% completed

Previous
Next
Quiz
Question 1
How do you declare a one-dimensional array of integers named numbers in Java?
A
int numbers = new int[];
B
int[] numbers;
C
array numbers = new int[5];
D
int numbers();
Question 2
What is the output of the following Java code?
int[] numbers = {3, 1, 4, 1, 5};
Arrays.sort(numbers);
System.out.println(Arrays.toString(numbers));
A
[1, 1, 3, 4, 5]
B
[5, 4, 3, 1, 1]
C
[3, 1, 4, 1, 5]
D
[1, 3, 1, 4, 5]
Question 3
How do you access the third element of first raw of a two-dimensional array matrix in Java?
A
matrix[2][0]
B
matrix[0][2]
C
matrix[3][1]
D
matrix[2][1]

.....

.....

.....

Like the course? Get enrolled and start learning!
Previous
Next