Which of the following Array declaration statement is illegal?

Java Array Quiz

Quiz
•
Mathematics
•
University
•
Hard
simamkele yawa
Used 3+ times
FREE Resource
48 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
5 mins • 2 pts
int [ ] a [ ] = new int [4] [4];
int a[ ][ ] = new int [4] [4];
int a[ ] [ ] = new int [ ] [4];
int [ ] a [ ] = new int [4] [ ];
2.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
What will happen if you try to compile and run the following code ? public class Test { public static void main (String args[]) { int[] arr = new int [] {1,2,3}; System.out.println(arr[1]); } }
1
Error: arr is referenced before it is initialized
2
Error: size of array must be defined
3.
MULTIPLE CHOICE QUESTION
1 min • 1 pt
In the given Array declaration, which expression returns the output as 5? int [] arr = { 23, 5, 78, 34, 2};
arr.length()
arr[].length()
arr[].length
arr.length
4.
MULTIPLE CHOICE QUESTION
5 mins • 3 pts
What will be the output upon the execution of the following code ? public class Test { public static void main(String[] args) { int j = 5; for (int i = 0; i< j; i++) { if ( i <= j-- ) System.out.print( (i*j) + " "); } } }
0 3 2
1 2 3
0 3 4
1 4 2
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which declaration of the main() method is valid ?
public void main( String args [] )
public void static main( String args [] )
final public static void main(String[] arr)
public static void main( String[] arr)
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code ? public class Test { public static void main(String[] args) { double d = 100.04; float f = d; System.out.println("Float value "+f); } }
100.04
100.0
Compilation Error (lossy conversion from double to float)
100
7.
MULTIPLE CHOICE QUESTION
45 sec • 1 pt
Is it possible in Java to create arrays of length zero ?
Yes, you can create arrays of any type with length zero.
No, it is not possible to create arrays of length zero in Java.
Create a free account and access millions of resources
Similar Resources on Quizizz
48 questions
Final Exam Review

Quiz
•
12th Grade - University
50 questions
Discrete Mathematics: Long Examination 2

Quiz
•
University
50 questions
теория информации 51-100

Quiz
•
University
52 questions
теория информации 101-152

Quiz
•
University
45 questions
Math Final Review

Quiz
•
University
50 questions
Программалау сұрақтары

Quiz
•
University
50 questions
Современные языки и технологии программирования

Quiz
•
University
51 questions
ÔN TẬP CUỐI HỌC KÌ II

Quiz
•
University
Popular Resources on Quizizz
15 questions
Multiplication Facts

Quiz
•
4th Grade
25 questions
SS Combined Advisory Quiz

Quiz
•
6th - 8th Grade
40 questions
Week 4 Student In Class Practice Set

Quiz
•
9th - 12th Grade
40 questions
SOL: ILE DNA Tech, Gen, Evol 2025

Quiz
•
9th - 12th Grade
20 questions
NC Universities (R2H)

Quiz
•
9th - 12th Grade
15 questions
June Review Quiz

Quiz
•
Professional Development
20 questions
Congruent and Similar Triangles

Quiz
•
8th Grade
25 questions
Triangle Inequalities

Quiz
•
10th - 12th Grade