Java Arrays

Java Arrays

University

10 Qs

quiz-placeholder

Similar activities

Round 2 for Preplacement Bootcamp

Round 2 for Preplacement Bootcamp

University

15 Qs

Web Designing Quiz-2

Web Designing Quiz-2

University

10 Qs

Teste python- Unesp-Jaboticabal

Teste python- Unesp-Jaboticabal

University

10 Qs

Đề Kiểm Tra Tin Học Lớp 4

Đề Kiểm Tra Tin Học Lớp 4

5th Grade - University

12 Qs

English for tech

English for tech

University

10 Qs

Bài tập lớp 4_tuần 5

Bài tập lớp 4_tuần 5

University

10 Qs

Modulasi

Modulasi

University

10 Qs

uas-siber

uas-siber

University

10 Qs

Java Arrays

Java Arrays

Assessment

Quiz

Computers

University

Practice Problem

Medium

Created by

Jeevitha P

Used 581+ times

FREE Resource

AI

Enhance your content in a minute

Add similar questions
Adjust reading levels
Convert to real-world scenario
Translate activity
More...

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

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 QUESTION

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 QUESTION

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 QUESTION

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 QUESTION

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.*

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of the following is/are advantages of packages?

Packages avoid name clashes

Classes, even though they are visible outside their package, can have fields visible to packages only

We can have hidden classes that are used by the packages, but not visible outside.

All of the above

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which of these is a mechanism for naming and visibility control of a class and its content?

Object

Packages

Interfaces

None of the above

Create a free account and access millions of resources

Create resources

Host any resource

Get auto-graded reports

Google

Continue with Google

Email

Continue with Email

Classlink

Continue with Classlink

Clever

Continue with Clever

or continue with

Microsoft

Microsoft

Apple

Apple

Others

Others

Already have an account?