Search Header Logo
Copy of CSA [06] ArrayLists and String Methods - Lesson 4 - ArrayLists

Copy of CSA [06] ArrayLists and String Methods - Lesson 4 - ArrayLists

Assessment

Presentation

Fun

9th - 12th Grade

Hard

Created by

Derrick Heffelfinger

FREE Resource

16 Slides • 18 Questions

1

media

2

media

3

Open Ended

How do you think using a list to manage customer orders could improve the workflow in a busy food truck environment?

4

Multiple Choice

Why might a food truck owner prefer to use an ArrayList to manage customer orders instead of a regular array?

1

ArrayLists can dynamically change size as orders are added or removed.

2

ArrayLists are faster than arrays for all operations.

3

ArrayLists can only store numbers, making them more efficient.

4

ArrayLists automatically sort the orders.

5

media

6

Open Ended

How is an ArrayList different from a 1D array?

7

media

8

Multiple Choice

Which of the following best describes a static data structure?

1

A data structure that grows and shrinks as needed

2

A data structure that is fixed in size

3

A data structure that can only store integers

4

A data structure that cannot be changed after creation

9

media

10

Multiple Choice

Based on the diagrams and descriptions, what is the main advantage of using a dynamic data structure like an ArrayList over a static data structure like an array?

1

It is faster to access elements

2

It can grow and shrink as needed

3

It uses less memory

4

It can only store numbers

11

media

12

Open Ended

When would we want to use an ArrayList instead of a 1D array?

13

media

14

Fill in the Blanks

15

media

16

Multiple Choice

To use an ArrayList in our programs, we need to import ___.

1

java.util.ArrayList

2

java.io.ArrayList

3

java.lang.ArrayList

4

java.data.ArrayList

17

media

18

Multiple Choice

What is the correct way to create an ArrayList that stores Integer objects in Java?

1

ArrayList numbers = new ArrayList();

2

ArrayList numbers = new ArrayList();

3

ArrayList numbers = new ArrayList();

4

ArrayList numbers = new ArrayList();

19

media

20

Multiple Choice

How does the add() method work differently when called with one argument versus two arguments in an ArrayList?

1

With one argument, it adds to the end; with two, it adds at a specific index and shifts elements.

2

With one argument, it removes an element; with two, it replaces an element.

3

With one argument, it sorts the list; with two, it reverses the list.

4

With one argument, it clears the list; with two, it duplicates the list.

21

media

22

Open Ended

Explain how the indices of an ArrayList are determined and what is the index of the last element if the list has n elements.

23

media

24

Open Ended

What is the purpose of the size () method variable in the ArrayList class?

Extra Credit why not just make the size instance variable public? Why the getter?

25

media

26

Multiple Choice

Which of the following statements about DEFAULT_CAPACITY in ArrayList is correct?

1

It is the initial length of the array used to store elements in the ArrayList.

2

It is the maximum number of elements an ArrayList can ever have.

3

It is the current number of elements in the ArrayList.

4

It is the number of methods in the ArrayList class.

27

media

28

Fill in the Blanks

29

media

30

Multiple Choice

Which of the following best describes the purpose of the 'data' instance variable in an ArrayList?

1

It stores the elements of the ArrayList in memory.

2

It defines the default capacity of the ArrayList.

3

It keeps track of the number of elements in the ArrayList.

4

It determines the type of the ArrayList.

31

media

32

Open Ended

Explain the difference between a static data structure and a dynamic data structure, and provide an example of each.

33

Multiple Choice

Would you like to learn more about how ArrayLists can be used to solve problems in computer science?

1

Yes, I want to learn more.

2

No, I feel confident with what I know.

3

Maybe, if there are more examples.

4

I'm not sure yet.

34

Open Ended

Reflecting on today's lesson about ArrayLists, what is one real-world scenario where you think using an ArrayList would be more beneficial than using a regular array?

media

Show answer

Auto Play

Slide 1 / 34

SLIDE