Search Header Logo

Chapter 13

Authored by Bill Butterfield

Computers

9th - 12th Grade

Used 12+ times

Chapter 13
AI

AI Actions

Add similar questions

Adjust reading levels

Convert to real-world scenario

Translate activity

More...

    Content View

    Student View

16 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following is a true statement?

Once created, an array cannot be resized.
When an array of objects is created using the new operator, its elements get random values.
Arrays never hold duplicate values.
Arrays can not be sorted.

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What happens when the number of elements in an ArrayList<SomeType> list has reached its capacity and you call list.add(x)?

A larger array is allocated, the values from the old array are copied into the new array, then x is appended to the list.
The list remains unchanged and add returns false.
IllegalStateException
ArrayIndexOutOfBoundsException

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a true statement?

java.util.ArrayList<E> extends java.util.List<E>.
An ArrayList<Object> can hold objects of any type.
An ArrayList<boolean> holds Boolean values.
An ArrayList<int> holds Integer values.

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a true statement?

An ArrayList<String> holds references to String objects.
An ArrayList<String> can also hold references to Object objects.
An ArrayList<Double> can also hold references to Integer objects, due to the principle of narrowing.
An ArrayList<Integer> can also hold references to Double objects due to the principle of widening.

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a true statement?

The same object can simultaneously belong to an array and to an ArrayList.
After it has been added to an ArrayList, an object cannot change.
If an ArrayList<Object> lst already contains an object x, you cannot add x again at the end of lst — a lst.add(x) call will return false. 
ArrayLists automatically filter out duplicates.

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

The ArrayList class has a constructor that takes one int parameter. new ArrayList<Object>(n)creates an ArrayList with the

capacity n and size 0.
capacity n and size n, with all the elements set to null.
capacity 2*n and size n, with all the elements set to null.
default capacity or capacity n, whichever is larger, and size 0. 

7.

MULTIPLE CHOICE QUESTION

20 sec • 1 pt

Which of the following ArrayList<E>’s methods returns an object of the type E?

get and set
rename and replace
contains and isEmpty
toString and size

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?