ArrayList Practice Questions

ArrayList Practice Questions

Assessment

Flashcard

Instructional Technology

11th Grade

Practice Problem

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

18 questions

Show all answers

1.

FLASHCARD QUESTION

Front

What method is used to get the number of elements in an ArrayList?

Back

size()

2.

FLASHCARD QUESTION

Front

Which of the following is NOT true about ArrayLists?
They can hold primitive types directly,
They are mutable,
They are part of the java.util package,
They can change size during runtime

Back

They can hold primitive types directly

3.

FLASHCARD QUESTION

Front

Why do ArrayLists use get and set methods instead of the index operator?

Back

Because ArrayLists are a class with methods.

4.

FLASHCARD QUESTION

Front

Which statement below is the correct way to retrieve the first element in the nums ArrayList? Options: nums.get(0), nums[0], nums(0), nums[1]

Back

nums.get(0)

5.

FLASHCARD QUESTION

Front

What is the starting index of an ArrayList?

Back

0

6.

FLASHCARD QUESTION

Front

What happens automatically when primitive types are added to an ArrayList?

Back

They are wrapped in objects.

7.

FLASHCARD QUESTION

Front

What is the correct way to add an integer to an ArrayList in all Java versions? Options: list.add(new Integer(5));, list.add(5);, list.add(Integer.valueOf(5));, list.add(5.0);

Back

list.add(5);

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?