Java Arrays

Java Arrays

Assessment

Assessment

Created by

Jeevitha P

Computers

University

552 plays

Hard

Student preview

quiz-placeholder

10 questions

Show answers

1.

Multiple Choice

30 sec

1 pt

Which of the following is FALSE about arrays on Java

A java array is always an object

Length of array can be changed after creation of array

Arrays in Java are always allocated on heap

2.

Multiple Choice

45 sec

1 pt

Predict the output?

public class Main {

public static void main(String args[]) {

int arr[] = {10, 20, 30, 40, 50};

for(int i=0; i < arr.length; i++)

{

System.out.print(" " + arr[i]);

}

}

}

10 20 30 40 50

Compiler Error

10 20 30 40

3.

Multiple Choice

1 min

1 pt

class Test {

public static void main(String args[]) {

int arr[2];

System.out.println(arr[0]);

System.out.println(arr[1]);

}

}

0

0

garbage value

garbage value

Compiler Error

Exception

4.

Multiple Choice

1 min

1 pt

public class Main {

public static void main(String args[]) {

int arr[][] = new int[4][];

arr[0] = new int[1];

arr[1] = new int[2];

arr[2] = new int[3];

arr[3] = new int[4];

int i, j, k = 0;

for (i = 0; i < 4; i++) {

for (j = 0; j < i + 1; j++) {

arr[i][j] = k;

k++;

}

}

for (i = 0; i < 4; i++) {

for (j = 0; j < i + 1; j++) {

System.out.print(" " + arr[i][j]);

k++;

}

System.out.println();

}

}

}

Compiler Error

0

1 2

3 4 5

6 7 8 9

0

0 0

0 0 0

0 0 0 0

9

7 8

4 5 6

0 1 2 3

5.

Multiple Choice

45 sec

1 pt

Which of the following is the correct way of importing an entire package ‘pkg’?

import pkg.

Import pkg.

import pkg.*

Import pkg.*

Explore all questions with a free account

or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?

Find a similar activity

Create activity tailored to your needs using

Quizizz AI
JAVA array

10 questions

JAVA array

assessment

12th Grade - University

Arrays

12 questions

Arrays

assessment

University

Java Quiz

13 questions

Java Quiz

assessment

University

java

10 questions

java

assessment

University

Programming 1

10 questions

Programming 1

assessment

University

Java Quiz 2

9 questions

Java Quiz 2

assessment

University

Arrays in Java 3CSE2

10 questions

Arrays in Java 3CSE2

assessment

University

JAVA - Arrays

15 questions

JAVA - Arrays

assessment

University - Professi...