Search Header Logo

L4 Collections & Arraylist

Authored by Coder Warman

Computers

University

Used 1+ times

L4 Collections & 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

30 sec • 1 pt

What is a dynamic array in Java?

An array with fixed size

An array that can resize itself when elements are added beyond its capacity

A data structure that only supports reading elements

A list that can store only integers

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the main advantage of using an ArrayList over a regular array in Java?

ArrayList allows duplicate elements

ArrayList can grow and shrink dynamically

ArrayList has faster access time than an array

ArrayList can only hold primitive data types

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is the correct syntax for creating an ArrayList of integers in Java?

ArrayList list = new ArrayList<>();

ArrayList list = new ArrayList<>();

ArrayList[] list = new ArrayList();

ArrayList list = new ArrayList[10];

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which method is used to add an element to an ArrayList in Java?

add()

insert()

append()

push()

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you initialize an empty ArrayList in Java?

new ArrayList();

ArrayList list = new ArrayList();

ArrayList list();

ArrayList list = new ArrayList();

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What does the Iterable interface in Java represent?

A collection of objects stored in an array

A structure that can be iterated over using a for-each loop

A class that allows only one element at a time

A data structure that can only be iterated using an iterator

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the default initial capacity of an ArrayList in Java?

10

1

5

20

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?

Discover more resources for Computers