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

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

Assessment

Flashcard

Computers

9th - 12th Grade

Practice Problem

Easy

Created by

Wayground Content

Used 1+ times

FREE Resource

Student preview

quiz-placeholder

30 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What is the correct way to declare an array in Java? Options: int arr[] = new int[5];, int arr() = new int[5];, int arr = new int[5];, array int arr = new int[5];, int[5] arr;

Back

int arr[] = new int[5];

2.

FLASHCARD QUESTION

Front

What is the default value of an int array element in Java?

Back

0

3.

FLASHCARD QUESTION

Front

How do you get the length of an array arr in Java?

Back

arr.length

4.

FLASHCARD QUESTION

Front

What will arr[arr.length - 1] return?

Back

The last element

5.

FLASHCARD QUESTION

Front

Which exception is thrown for accessing an array index out of bounds? Options: IndexOutOfRangeException, OutOfMemoryError, NullPointerException, ArrayIndexOutOfBoundsException, IllegalArgumentException

Back

ArrayIndexOutOfBoundsException

6.

FLASHCARD QUESTION

Front

What is the index of the first element in an array?

Back

0

7.

FLASHCARD QUESTION

Front

Which of the following creates a 2D array? int arr[][] = new int[2][3];, int arr[] = new int[2,3];, int arr[2][3];, int arr = int[2][3];, int[][] arr = {2,3};

Back

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

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?