Data Structures 2 Flashcards
Which type of operation is represented in the pseudocode?
int x,y,z;
x=y=z=100;
Assignment
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]
Array
Which data type is appropriate for this array to store the given data?
a = [“AF”, “71”, “BC”, “157”, “BA”, “253”]
String
Which data type is appropriate for the given data set?
a = [1, 717, 23, 12, 314, 6]
Int
Which data type should be used for this object?
days = { “Sunday”, “Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”}
String
Which data type should be used for this variable?
phoneNum = “212-555-1212”
String
What is true about garbage collection?
It reclaims memory from data structures implemented using linked allocations.
What is true about a data structure implemented using linked allocation?
Storage is allocated using pointers to new locations as needed.
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?
90 and 99
What is the effect on the object Computing regarding garbage collection?
Computing obj = new Computing(); obj = null;
It is automatically available for garbage collection.