Search Header Logo

Java Programming Quiz

Authored by Niveditha N

Other

University

Used 1+ times

Java Programming Quiz
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

57 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which method is used to sort an array in Java?

Collections.sort()

Arrays.sort()

array.sort()

sort.array()

2.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following is a valid declaration of a 2D array?

int[][] arr = new int[2][3];

int arr[][] = new int[2,3];

int arr[] = new int[2][3];

int arr[2][3];

3.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What does this code print? int[][] matrix = { {1, 2}, {3, 4} }; System.out.println(matrix[1][1]);

2

3

4

1

4.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which loop is best for traversing arrays in Java?

while

do-while

for

goto

5.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

What is the output of the following code? String s1 = "Java"; String s2 = "Java"; System.out.println(s1 == s2);

true

false

error

null

6.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which method is used to compare two strings by ignoring case?

equals()

equalsIgnoreCase()

compareTo()

compareIgnoreCase()

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following is used to concatenate two strings?

concat()

append()

+ operator

All of the above

Access all questions and much more by creating a free account

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?