Search Header Logo
PGAS - Arrays & ArrayLists

PGAS - Arrays & ArrayLists

Assessment

Flashcard

•

Computers

•

1st Grade

•

Practice Problem

•

Hard

Created by

Wayground Content

FREE Resource

Student preview

quiz-placeholder

21 questions

Show all answers

1.

FLASHCARD QUESTION

Front

Which is correct syntax to access an element of an ArrayList in Java? Options: list.get(index), list[index], list.getElement(index), list.index

Back

list.get(index)

2.

FLASHCARD QUESTION

Front

What does it mean for a list to be "dynamic"?

Back

You can easily add and remove elements.

3.

FLASHCARD QUESTION

Front

How do you get the number of elements in an ArrayList called "list" in Java?

Back

list.size();

4.

FLASHCARD QUESTION

Front

The _________ method will return the total elements in an ArrayList.

Back

size()

5.

FLASHCARD QUESTION

Front

What are the legal indexes for the array ar, given the following declaration:

int[] ar = {2, 4, 6, 8 }
?

Back

0, 1, 2, 3

6.

FLASHCARD QUESTION

Front

The ArrayList nums is initialized with the values [5, 3, 1]. What is displayed when the following code is executed?
nums.add(6);
nums.add(0, 4);
nums.remove(1);

Back

[4, 3, 1, 6]

7.

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)

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

Microsoft

Continue with Microsoft

or continue with

Facebook

Facebook

Apple

Apple

Others

Others

By signing up, you agree to our Terms of Service & Privacy Policy

Already have an account?