Unit 2 Quiz Flashcards

1
Q

The length() method is used to check the size of a stack?

True or False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which methods are used to add and remove items from a stack?

A

Push, pop

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Which statement would properly add an element to an ArrayList called colors?

A

colors.add(“blue”);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which methods are used to add and remove items from a Linked List?

A

add, remove

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which import statement should be used when using Array Lists?

A

import.java.util.ArrayList;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Which method below is NOT a member of the ArrayList class?

A

length()

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The ArrayList, LinkedList, ArrayDeque classes and the List, queue, and Deque interfaces are part of which larger Java APT body?

A

Java Collections Framework

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Which statement would access the 3rd element in an ArrayList called colors?

A

colors.get(2);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

A Queue uses LIFO?

True or False

A

False, it uses FIFO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

A Stack uses LIFO?

True or False?

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly