DATA STRUCTURES LIST EXAM
QUESTIONS AND ANSWERS
A(n) _ Is an indexed data structure, which means you can select its elements in an
arbitrary order as determined by the subscript value - Correct Answers -Array
T/F the size is fixed for an array object - Correct Answers –True
What are the steps to insert a new item at the head of a linked list - Correct Answers -
Assign a head, give node, increment size by 1
Head= new Node(0,head);
Size++;
Suppose that p is a reference to a node in a linked list and it is not the tail node. What
are the steps to removing the node after p - Correct Answers -p.next = p.next.next;
Size--;
A(n) _ is a data structure that contains a data item and one or more links - Correct
Answers -Node
You could create a circular list from a single linked list by executing what statement -
Correct Answers -tail.next = head;
Draw a picture of the memory after the following statements
Int[] m = new int[2];
M[0] = 0;
M[1] = 1;
Int[] p = m;
p[0] = 4;
p[0] = 5; - Correct Answers -M -^
0
1
P-^
Both pointing at same array
Draw a picture of the memory after the filling statements
Int[] x = new int[2];
X[0] = 1;
QUESTIONS AND ANSWERS
A(n) _ Is an indexed data structure, which means you can select its elements in an
arbitrary order as determined by the subscript value - Correct Answers -Array
T/F the size is fixed for an array object - Correct Answers –True
What are the steps to insert a new item at the head of a linked list - Correct Answers -
Assign a head, give node, increment size by 1
Head= new Node(0,head);
Size++;
Suppose that p is a reference to a node in a linked list and it is not the tail node. What
are the steps to removing the node after p - Correct Answers -p.next = p.next.next;
Size--;
A(n) _ is a data structure that contains a data item and one or more links - Correct
Answers -Node
You could create a circular list from a single linked list by executing what statement -
Correct Answers -tail.next = head;
Draw a picture of the memory after the following statements
Int[] m = new int[2];
M[0] = 0;
M[1] = 1;
Int[] p = m;
p[0] = 4;
p[0] = 5; - Correct Answers -M -^
0
1
P-^
Both pointing at same array
Draw a picture of the memory after the filling statements
Int[] x = new int[2];
X[0] = 1;