Unit 7 ArrayLists

Unit 7 ArrayLists

Assessment

Quiz

Computers

9th - 12th Grade

Practice Problem

Medium

Created by

Lauren Olson

Used 146+ times

FREE Resource

Student preview

quiz-placeholder

25 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Which is the correct way to declare an ArrayList of Strings in Java?

ArrayList<String>
ArrayList(String)
ArrayList[String]
ArrayList{String}

2.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Which is correct syntax to access an element of an ArrayList in Java?

list.get(index)
list[index]
list.getElement(index)
list.index

3.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

How do you add an element with the value "Pikachu" to the back of an ArrayList called "pokemon" in Java?

pokemon.add("Pikachu");

pokemon.append("Pikachu");

pokemon.push_back("Pikachu");

pokemon[last_index + 1] = "Pikachu";

4.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

How do you get the number of elements in an ArrayList called "list" in Java?

list.size();
list.count();
list.length();
list.getSize();

5.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

If an ArrayList<String> list has been initialized with 5 strings, the statement


list.add(6, "cat");


will throw an IndexOutOfBoundsException.

TRUE

FALSE

6.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

You can add an item in a(n) ____ and the size expands automatically to accommodate the new item.

Array

ArrayList

ResizableArray

array

7.

MULTIPLE CHOICE QUESTION

15 mins • 1 pt

Media Image

Consider the following code segment:
What is printed as a result of executing the code segment?

[P, Q, R, s, T]
[P, Q, s, T, u]
[P, Q, T, s, u]
[P, T, Q, s, u]

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?