This quiz covers basic concepts of arrays in programming, focusing on array indexing, length, and element identification in Java.
6
5
7
9
Rate this question:
A[2]
A{2}
A[3]
A(3)
Rate this question:
2.0
3.4
3.5
5.5
Rate this question:
1
3
2
4
Rate this question:
Int[] a = new int(2);
Int a() = new int[2];
Int a = new int[2];
int a[] = new int[2];
Int[] a = new int[2];
4
5
0
6
Rate this question:
Index variable
Indexed variable
Array
Array variable
Rate this question:
The program has a compile error because the size of the array wasn't specified when declaring the array.
He program has a runtime error because the array element x[0] is not defined.
The program runs fine and displays x[0] is 0.
Rate this question:
The program compiles and runs fine and the output "Value is 2.0" is printed.
The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by {1, 2, 3}.
The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by new double[3]{1, 2, 3};
The program compiles and runs fine and the output "Value is 1.0" is printed.
Rate this question:
Char[2] charArray = {'a', 'b'};
Char[] charArray = {'a', 'b'};
Char[] charArray = new char[]{'a', 'b'};
Char[] charArray = new char[2]; charArray = {'a', 'b'};
Rate this question:
Int[] i = {3, 4, 3, 2};
Int i = new int(30);
Double d[] = new double[30];
Char[] c = new char();
Rate this question:
I
(int)(Math.random() * 100))
I + 10
Math.random() * 100
Rate this question:
He program compiles and runs fine and the output "Value is 2.0" is printed.
The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by {1, 2, 3}.
The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by new double[3]{1, 2, 3};
The program has a compile error because the syntax new double[]{1, 2, 3} is wrong and it should be replaced by new double[]{1.0, 2.0, 3.0};
Rate this question:
4
2
1
3
Rate this question:
0
1
4
3
Rate this question:
The program has a runtime error because the last statement in the main method causes ArrayIndexOutOfBoundsException.
He program displays 0 1 2
The program displays 4.
The program has a compile error because i is not defined in the last statement in the main method.
Rate this question:
The program displays 2.5, 3.0 4.0
The program displays 2.5 3.0 4.0
The program displays 2.5, 3, 4
The program has a syntax error because value is undefined.
Rate this question:
1 1 2 3 4 5
1 2 3 4 5 6
6 1 2 3 4 5
6 2 3 4 5 1
Rate this question:
120 200 14
120 200 16
016 is a compile error. It should be written as 16.
120 200 20
Rate this question:
2 3 4 5 6 1
1 2 3 4 5 6
2 3 4 5 6 1
1 1 1 1 1 1
Rate this question:
123
012
234
013
Rate this question:
The program displays 1 2 3 4
The program has a compile error on the statement x = new int[2], because x is final and cannot be changed.
The program displays 0 0
The elements in the array x cannot be changed, because x is final.
Rate this question:
The code has compile errors because the variable list cannot be changed once it is assigned.
The code can compile and run fine. The second line assigns a new array to list.
The code has compile errors because you cannot assign a different size array to list.
The code has runtime errors because the variable list cannot be changed once it is assigned.
Rate this question:
The program has a compile error because new int[2] is assigned to a.
He program has a runtime error because a[1] is not initialized.
The program displays a[1] is 0.
The program displays a[1] is 1.
Rate this question:
A copy of the array
The reference of the array
A copy of the first element
He length of the array
Rate this question:
Return int[]{1, 2, 3};
Return new int[]{1, 2, 3};
Return {1, 2, 3};
Return 1;
Rate this question:
654321
123456
234567
765432
Rate this question:
Public static void print(double... numbers, String name)
Public static void print(double... numbers)
Public static void print(int n, double... numbers)
Public static void print(String... strings, double... numbers)
Rate this question:
PrintMax(1, 2, 2, 1, 4);
PrintMax(new double[]{1, 2, 3});
PrintMax(1.0, 2.0, 2.0, 1.0, 4.0);
Option 4
Rate this question:
Low is 5 and high is 4
Low is 3 and high is 6
Low is 0 and high is 6
Low is 6 and high is 5
2.1, 3.1, 2.5, 6.4, 3.1
3.1, 3.1, 2.5, 2.1, 6.4
2.1, 2.5, 3.1, 3.1, 6.4
2.5, 3.1, 3.1, 6.4, 2.1
Rate this question:
Ist1 is 3.1, 3.1, 2.5, 6.4
List1 is 2.5 3.1, 3.1, 6.4
List1 is 6.4, 3.1, 3.1, 2.5
List1 is 3.1, 2.5, 3.1, 6.4
Rate this question:
Java.util.Arrays(scores)
Java.util.Arrays.sorts(scores)
Java.util.Arrays.sort(scores)
Njava.util.Arrays.sortArray(scores)
Rate this question:
2
-1
2
4
Rate this question:
-2
-1
1
2
Rate this question:
[1, 20, 30, 40, 50]
{1, 20, 30, 40, 50}
{1 20 30 40 50}
1 20 30 40 50]
Rate this question:
Args[0]
Args[2]
Args[3]
Args[1]
Rate this question:
Ow is 5 and high is 4
Ow is 3 and high is 6
Low is 0 and high is 6
Low is 6 and high is 5
Nt count = args.length - 1;
Int count = args.length;
Int count = 0; while (args[count] != null) count ++;
Int count=0; while (!(args[count].equals(""))) count ++;
Rate this question:
String[] a = {"", "", "", "", ""};
String[] a = new String [5];
String[5] a;
String[ ] a = new String [5]; for (int i = 0; i < 5; a[i++] = null);
Rate this question:
If you run this program without passing any arguments, the program would have a runtime error because argv is null.
The program has a compile error because String args[] is wrong and it should be replaced by String args[].
If you run this program without passing any arguments, the program would display argv.length is 0.
If you run this program without passing any arguments, the program would have a runtime error because argv is null.
Rate this question:
A[0][0]
A[1][1]
A[0][1]
A[1][0]
Rate this question:
True
False
Rate this question:
25
30
36
25
Rate this question:
The program has a compile error because new boolean[3][] is wrong.
The program runs and displays x[2][2] is false.
The program has a runtime error because x[2][2] is null.
He program runs and displays x[2][2] is false.
Rate this question:
3 & 2
2 and 1
2 and 2
3 and 3
Rate this question:
2,3,4
4,3,2
1,2,3
5,4,3
Rate this question:
True
False
Rate this question:
Quiz Review Timeline (Updated): Mar 20, 2023 +
Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.
Wait!
Here's an interesting quiz for you.