comp 5 Flashcards

1
Q

Another well-known data structure of Java is the ___

A

arraylist

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

is a basic functionality provided by Java

A

array

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

______ is a class of Java Collections framework.

A

ArrayList

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

arraylist belongs to

A

java.util package.

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

An ArrayList is a ______, where items can be added and removed from the list.

A

dynamic data structure

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

An ArrayList is a dynamic data structure, where _____

A

items can be added and removed from the list.

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

ArrayList cannot store _______; it can only store _____

A

primitive types
objects of the same type.

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

Syntax on creating an instance of ArrayList:

A

ArrayList<Type> variable = new ArrayList<Type>();</Type></Type>

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

to insert elements

A

add() method

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

to access an item.

A

get() method

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

to change an item.

A

set() method

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

to remove an item.

A

remove() method

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

to get the size of the arraylist

A

size() method

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

These are some ways in iterating inside an arraylist:

A

for-loop

enhance for-loop

Iterator class

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

Use the ____ method in the for-loop

A

get() and size()

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

To use the iterator, you must create an ____

A

Iterator object.

17
Q

how to create an iterator object?

A

Syntax: Iterator<type> object = arraylist.iterator();</type>

18
Q

The 2 methods used in Iterator class are ____

A

hasNext() and next()