
Java Array Quiz
Authored by simamkele yawa
Mathematics
University
Used 3+ times

AI Actions
Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...
Content View
Student View
48 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
5 mins • 2 pts
Which of the following Array declaration statement is illegal?
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.
Access all questions and much more by creating a free account
Create resources
Host any resource
Get auto-graded reports

Continue with Google

Continue with Email

Continue with Classlink

Continue with Clever
or continue with

Microsoft
%20(1).png)
Apple
Others
Already have an account?
Similar Resources on Wayground
50 questions
MIDTERM EXAM
Quiz
•
University
46 questions
6A- Unit 6 Test Review Quizizz
Quiz
•
6th Grade - University
50 questions
5th Six Weeks Review: Quadrilaterals & Area 2D
Quiz
•
10th Grade - University
51 questions
Inequalities Christmas
Quiz
•
7th Grade - University
50 questions
Unit 1 Math Review MYP 1
Quiz
•
6th Grade - University
45 questions
Math 8 Triangle Inequalities and Probability
Quiz
•
8th Grade - University
50 questions
Mathematics 7 Third Quarter Exam
Quiz
•
7th Grade - University
45 questions
Chi-Square Statistical Reasoning
Quiz
•
10th Grade - University
Popular Resources on Wayground
15 questions
Fractions on a Number Line
Quiz
•
3rd Grade
20 questions
Equivalent Fractions
Quiz
•
3rd Grade
25 questions
Multiplication Facts
Quiz
•
5th Grade
22 questions
fractions
Quiz
•
3rd Grade
20 questions
Main Idea and Details
Quiz
•
5th Grade
20 questions
Context Clues
Quiz
•
6th Grade
15 questions
Equivalent Fractions
Quiz
•
4th Grade
20 questions
Figurative Language Review
Quiz
•
6th Grade