
Java Array Questions
Quiz
โข
Computers
โข
University
โข
Practice Problem
โข
Easy
Satish T
Used 4+ times
FREE Resource
Enhance your content in a minute
50 questions
Show all answers
1.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
What is the output? int[] a = {1, 2, 3, 4, 5}; System.out.println(a[a.length - 1]);
1
4
5 (Correct)
Compilation error
2.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
What will happen? int[][] m = new int[2][2]; System.out.println(m[1][1]);
0 (Correct)
Compilation error
NullPointerException
ArrayIndexOutOfBoundsException
3.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
What will be printed? int[] a = {5, 4, 3}; System.out.println(a[-1]);
5
-1
ArrayIndexOutOfBoundsException (Correct)
Compilation error
4.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
Identify the result of the following snippet: int[][] arr = new int[2]; arr[0] = new int[2]; arr[1] = new int[3]; System.out.println(arr[1].length);
2
3 (Correct)
1
Compilation error
5.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
Which is valid declaration?
int arr[] = new int[3]; (Correct)
int[3] arr = new int[];
int[] arr = new int[];
int arr = new int[3];
6.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
What is the output? int[] a = {1, 2, 3, 4, 5}; System.out.println(a[a.length - 1]);
1
4
5 (Correct)
Compilation error
7.
MULTIPLE CHOICE QUESTION
30 sec โข 1 pt
What is the output? int[] x = new int[]{1, 2, 3}; x = new int[]{4, 5}; System.out.println(x[1]);
1
2
5 (Correct)
Compilation error
Create a free account and access millions of resources
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
Power BI Quiz
Quiz
โข
University
53 questions
UTS Struktur Data
Quiz
โข
University
50 questions
Test 1 - SDT 2113
Quiz
โข
University
50 questions
Quiz Python
Quiz
โข
University
48 questions
Module 10
Quiz
โข
University
54 questions
Python ัะตัั
Quiz
โข
University
55 questions
SAINS KOMPUTER TINGKATAN 4
Quiz
โข
12th Grade - University
Popular Resources on Wayground
5 questions
This is not a...winter edition (Drawing game)
Quiz
โข
1st - 5th Grade
25 questions
Multiplication Facts
Quiz
โข
5th Grade
10 questions
Identify Iconic Christmas Movie Scenes
Interactive video
โข
6th - 10th Grade
20 questions
Christmas Trivia
Quiz
โข
6th - 8th Grade
18 questions
Kids Christmas Trivia
Quiz
โข
KG - 5th Grade
11 questions
How well do you know your Christmas Characters?
Lesson
โข
3rd Grade
14 questions
Christmas Trivia
Quiz
โข
5th Grade
20 questions
How the Grinch Stole Christmas
Quiz
โข
5th Grade
Discover more resources for Computers
26 questions
Christmas Movie Trivia
Lesson
โข
8th Grade - Professio...
20 questions
christmas songs
Quiz
โข
KG - University
20 questions
Holiday Trivia
Quiz
โข
9th Grade - University
15 questions
Holiday Movies
Quiz
โข
University
14 questions
Christmas Trivia
Quiz
โข
3rd Grade - University
20 questions
Christmas Trivia
Quiz
โข
University
8 questions
5th, Unit 4, Lesson 8
Lesson
โข
KG - Professional Dev...
20 questions
Disney Trivia
Quiz
โข
University
