L4 Collections & Arraylist

L4 Collections & Arraylist

University

10 Qs

quiz-placeholder

Similar activities

Weekly Contest #3 - TechXNinjas

Weekly Contest #3 - TechXNinjas

University

10 Qs

Java Basics 1

Java Basics 1

University

10 Qs

java script

java script

University

10 Qs

C++Arrays Loops and Functions Review

C++Arrays Loops and Functions Review

University

15 Qs

Python Workshop Day - 2

Python Workshop Day - 2

University

15 Qs

BCSC0006 - Quiz 4 - Linked List & Stacks

BCSC0006 - Quiz 4 - Linked List & Stacks

University

10 Qs

Data Structure Quiz 1

Data Structure Quiz 1

University

9 Qs

J277 - 2.2 - Use of Arrays up to 2D

J277 - 2.2 - Use of Arrays up to 2D

10th Grade - University

8 Qs

L4 Collections & Arraylist

L4 Collections & Arraylist

Assessment

Quiz

Computers

University

Hard

Created by

Coder Warman

Used 1+ times

FREE Resource

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

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?