Java Arrays  Prt 1Quiz

Java Arrays Prt 1Quiz

9th - 12th Grade

15 Qs

quiz-placeholder

Similar activities

C Programming Concepts

C Programming Concepts

10th Grade

15 Qs

APCS A - Array 6.1,6.2,6.3,6.

APCS A - Array 6.1,6.2,6.3,6.

9th - 12th Grade

20 Qs

Arrays

Arrays

9th - 12th Grade

16 Qs

Arrays

Arrays

10th - 12th Grade

10 Qs

Java Arrays Quiz Review

Java Arrays Quiz Review

9th - 10th Grade

10 Qs

Arrays

Arrays

12th Grade

10 Qs

2D Arrays

2D Arrays

9th - 12th Grade

15 Qs

Programming

Programming

1st - 10th Grade

10 Qs

Java Arrays  Prt 1Quiz

Java Arrays Prt 1Quiz

Assessment

Quiz

Computers

9th - 12th Grade

Hard

Created by

Edwin Charikinya

Used 1+ times

FREE Resource

15 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main purpose of an array in Java?

To store multiple data types

To store a single value only

To create a collection of indexed like values

To link classes and objects

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default value assigned to elements in a newly created int array?

Null

-1

Random values

0

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the valid way to declare and create an array in a single line?

int numbers; = new int[6];

int numbers = new int[];

int[] numbers = new int[6];

int[] = new int[6] numbers;

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens if you access an array index that is out of bounds?

The value returned is null

Compilation error

ArrayIndexOutOfBoundsException

It returns the last element

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is an off-by-one error?

Initialising array with a negative size

Accessing index from 0 to array.length

Declaring an array without specifying a size

Using the wrong data type

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the .length property of an array return?

Number of non-zero elements

Maximum index

Number of elements in the array

Total memory used by the array

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which loop is recommended for read-only access to all elements in an array?

while loop

do-while loop

enhanced for loop

nested loop

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?