L4 Collections & Arraylist

L4 Collections & Arraylist

University

10 Qs

quiz-placeholder

Similar activities

Principles of Programming Languages

Principles of Programming Languages

University

15 Qs

Golang quiz pertemuan 2

Golang quiz pertemuan 2

University

10 Qs

DSA Day 1

DSA Day 1

University

15 Qs

CCS3101-CS1E

CCS3101-CS1E

University

11 Qs

Chapter 5 Java swing , small Apps

Chapter 5 Java swing , small Apps

University

10 Qs

DPJ5531 Revision

DPJ5531 Revision

University

12 Qs

QUIZ 7 PBO

QUIZ 7 PBO

University

10 Qs

DATA STRUCTURES MODULE 1 QUIZ

DATA STRUCTURES MODULE 1 QUIZ

University

10 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?