Search Header Logo

ArrayList

Authored by Suraya Masrom

Computers

1st Grade

Used 298+ times

ArrayList
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

Which is correct syntax to access an element of an ArrayList in Java?

list.get(index)
list[index]
list.getElement(index)
list.index

2.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

You can easily add and remove elements
It has a set size once it has been created
It may contain multiple types of values
You can access it from anywhere in the program

3.

MULTIPLE CHOICE QUESTION

45 sec • 1 pt

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

list.size();
list.count();
list.length();
list.getSize();

4.

MULTIPLE CHOICE QUESTION

3 mins • 1 pt

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

total()
length()
size()
length

5.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What are the legal indexes for the array ar, given the following declaration:
int[] ar = {2, 4, 6, 8 }

 0, 1, 2, 3
 1, 2, 3, 4
2, 4, 6, 8
 0, 2, 4, 6

6.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

What is the list nums if it is initially [5, 3, 1] and the following code is executed?

nums.add(6);

nums.add(0, 4);

nums.remove(1);

[4, 3, 1, 6]

[5, 3, 1, 6]

[4, 3, 6]

[4, 5, 3, 6]

7.

MULTIPLE CHOICE QUESTION

1 min • 1 pt

Which statement below is the correct way to retrieve the first element in the nums ArrayList?

nums.get(0)

nums[0]

nums(0)

nums[1]

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?