Data Structures 2 Flashcards

1
Q

Which type of operation is represented in the pseudocode?
int x,y,z;
x=y=z=100;

A

Assignment

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

What is the most efficient data type to use for this data set of a fixed size in Java?
a = [0, 0, 1, 4, 7, 16, 31, 64, 127]

A

Array

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

Which data type is appropriate for this array to store the given data?
a = [“AF”, “71”, “BC”, “157”, “BA”, “253”]

A

String

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

Which data type is appropriate for the given data set?
a = [1, 717, 23, 12, 314, 6]

A

Int

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

Which data type should be used for this object?
days = { “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”}

A

String

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

Which data type should be used for this variable?
phoneNum = “212-555-1212”

A

String

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

What is true about garbage collection?

A

It reclaims memory from data structures implemented using linked allocations.

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

What is true about a data structure implemented using linked allocation?

A

Storage is allocated using pointers to new locations as needed.

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

What are the array elements corresponding to the mid-values in the first and second iterations of a binary search in an array arr = {45, 77, 89, 90, 94, 99, 100} and key = 100?

A

90 and 99

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

What is the effect on the object Computing regarding garbage collection?
Computing obj = new Computing(); obj = null;

A

It is automatically available for garbage collection.

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