Stacks Flashcards

1
Q

The stack method to add an element to the stack is

A

att.push(“Some string”);

Stack<String> att = new Stack<>();</String>

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

The Stack method to remove an element is

A

Stack<String> att = new Stack<>()</String>

att.pop();

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

The Stack method to view an element at the top of the stack is

A

att.peek();

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

The Stack method to search an element to return its position in the stack is

A

att.search(“Some”);

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

The Stack method to check if a stack is empty is

A

att.empty(); and returns true or false

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

To make a list object of type ArrayList you

A

List<String> list1 = new ArrayList<>();</String>

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

To make a List object of type LinkedList you

A

List<String> list1 = new LinkedList<>();</String>

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

List object methods include

A

add()
addAll() all elements of one list to another
get() get random element from list

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