Search Header Logo

Java Quiz 2

Authored by Omphile Mosingathi

Computers

University

Used 3+ times

Java Quiz 2
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

40 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What package does ArrayList belong to?

A. java.io

B. java.util

C. java.lang

D. java.net

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the primary advantage of using an ArrayList over an array?

A. Fixed size

B. Dynamic size

C. Faster access

D. Less memory usage

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

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

A. insert()

B. append()

C. add()

D. put()

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

ArrayLists cannot store primitive types directly. What should be used instead?

A. Primitive Wrappers

B. Collections

C. Arrays

D. Interfaces

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a correct way to create an ArrayList of integers?

A. ArrayList<int> list = new ArrayList<>();

  • B. ArrayList<Integer> list = new ArrayList<>();

C. ArrayList<Int> list = new ArrayList<>();

D. ArrayList<int[]> list = new ArrayList<>();

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How do you sort an ArrayList in Java?

A. Collections.sort()

B. Arrays.sort()

C. List.sort()

D. ArrayList.sort()

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What method is used to remove an element from an ArrayList?

A. delete()

B. remove()

C. erase()

D. cut()

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