CSE 12 Quiz 3 Questions Gary Gillespie
How many NULL pointers are there in a circular doubly linked list with three elements?
0
How many NULL pointers are there in a singly linked list with three elements?
1
In a linked list, how many Nodes are needed to store an item in the list?
1
In inserting 10 items into the list of hw5 through driver2, how many different pointers to MyRec elements are past to List's insert method?
1
The efficiency of the Linked-List based Stack pop function is big-O of:
1
The efficiency of the Linked-List based Stack push function is big-O of:
1
The efficiency of the Linked-List based Stack top function is big-O of:
1
The efficiency of the Linked-List based insert function to insert at the beginning of the list is big-O of:
1
The efficiency of the Linked-List based insert function to insert at the end of the list is big-O of:
1
The efficiency of the Linked-List based remove function to remove at the end of the list is big-O of:
1
The efficiency of the Linked-List based remove function to remove from the beginning of the list is big-O of:
1
The efficiency of the Linked-List based view function to view at the beginning of the list is big-O of:
1
The efficiency of the Linked-List based view function to view at the end of the list is big-O of:
1
What are the four specific manipulations possible on the items stored in our hw5 list?
1) Deallocate 2) Copy 3) Check is greater than 4) Write it out
What are the two ways that delete_Node can be called such that the data it holds won't be deleted?
1) Delete function is null 2) Data pointer is null
In our linked list of hw5, list the two conditions either one of which indicates that the list is empty.
1) Front pointer is null 2) Occupancy is 0
What are the four constraint methods of MyRec?
1) copy 2) delete, 3) greater_than 4) write
The MyRec object structure definition of hw5 was created with what two design goals mentioned in class?
1) simple 2) representative of future objects to insert
In inserting 10 items into the list of hw5 through driver1, how many different pointers to MyRec elements are past to List's insert method?
10
How many NULL pointers are there in a doubly linked list with three elements?
2
Coding delete_List for hw5, which approach will execute more code, a loop of calls to : A. remove_List B. delete_Node. C. No difference.
A
Which is a better test case to test your calc of hw4: A. 1+2 B. 1+1 C. Neither one is better
A
When using a circular doubly linked list, what is the value of the pre pointer in the Node at the front of the list?
A pointer to the node at the end of the list
When using a circular doubly linked list, what is the value of the next pointer in the Node at the end of the list?
A pointer to the node at the front of the list
For the void pointer parameter of MyRec methods of hw5, when will a MyRec pointer be passed to a MyRec method using that parameter: A. Always B. Never C. Sometimes
A. Always
In a linked list, which direction does the pre pointer point?
Backwards
What is the best word to describe the algorithm used by each method of the linked-list based Stack of hw5?
Delegate - to the list methods to do the task
List the 5 layers of driver code for hw5 in order from outermost to innermost:
Driver -> Stack -> List -> Node -> MyRec
In hw5, which of driver1 or driver2 uses a reusable MyRec object allocated on the Run-Time Stack?
Driver 2
T or F: Any object can be inserted in a polymorphic generic container without any restrictions placed on that object.
False
T or F: Since the parameter to delete_MyRec is a void pointer, it will only deallocate the data but won't set the originating pointer to NULL
False
T or F: The array based Stack of hw3 is an example of a polymorphic generic container.
False
T or F: The calculator of hw4 is an example of a polymorphic generic container.
False
T or F: When called from the driver1 or driver 2 code in hw5, when a constraint method is called, it is called polymorphically.
False
T or F: When inserting into a doubly linked circular list, the code to insert at the front, end or anywhere in the list is achieved with three distinct sets of lines of code.
False
T or F: When removing from a doubly linked circular list, the code to remove from the front, end or anywhere in the list is achieved through three distinct sets of lines of code.
False
T or F: When using a polymorphic generic container, the container can manipulate objects only when knowing the types of those objects.
False
T or F. The MyRec methods of hw5 have void pointer parameters so these methods can be called passing in objects of different types.
False (Because the reason is so it can compile and run. list and stack use void pointers so MyRec has to match or else there will be compiler errors)
T or F: When delete_Node is called is called from remove_Node, it should delete only the data it holds, but not the Node.
False (deletes the node, not the data)
T or F: When delete_Node is called is called from remove_Node, it should delete both the Node and the data it holds.
False (it returns the data to the caller)
T or F: When drawing linked lists, an arrow that points to the bottom of the Node really points to the data field of that Node.
False (points to the upper left)
T or F: When drawing linked lists, an arrow that points to the side of the Node really points to the middle field of that Node.
False (points to the upper left)
T or F: The MyRec of hw5 is an example of a polymorphic generic container.
False (test object)
In a test case of inserting 1 to 5 at the front and 6-10 at the end of the list, what is the best word to describe seeing the list displayed?
Familiar (recognizable, obvious)
In a linked list, which direction does the next pointer point?
Forwards
In our linked list of hw5, in what section of memory are all List objects allocated?
Heap
In our linked list of hw5, in what section of memory are all Nodes allocated?
Heap
In our linked list of hw5, in what section of memory are all objects stored in the list allocated?
Heap
When inserting a MyRec into the list of hw5 through driver1, where is that MyRec object in memory?
Heap
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Push assuming Pop removes from the END of the List.
Insert(this_Stack, item, END);
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Push assuming Pop removes from the FRONT of the List.
Insert(this_Stack, item, FRONT);
When insert_Node's Node pointer parameter is NULL, what does that imply about the item being inserted into the list in hw5?
It's the first one
Considering a tiered or layered design, Node methods call _______ methods, and Node methods were called by _______ methods.
MyRec list
When using a non-circular doubly linked list, what is the value of the next pointer in the Node at the end of the list?
NULL
When using a non-circular doubly linked list, what is the value of the pre pointer in the Node at the front of the list?
NULL
When using a non-circular singly linked list, what is the value of the next pointer in the Node at the end of the list?
NULL
When the list of hw5 is working correctly, what differences does the user see when running driver1 and driver2?
None
What is the best one word to describe a list where all insertions occur at the end of the list and removals occur at the front of the list?
Queue
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Pop assuming Push inserts at the FRONT of the List.
Remove_List(this_Stack, FRONT);
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Pop assuming Push inserts at the END of the List.
Remove_list(this_Stack, END);
When inserting a MyRec into the list of hw5 through driver2, where is that MyRec object in memory?
Run Time Stack
What is the best one word to describe a list where all insertions and removals occur at the end of the list?
Stack
What is the best one word to describe a list where all insertions and removals occur at the front of the list?
Stack
What is the purpose of the MyRec object in hw5?
To test the list
What is the purpose of the MyRec methods in hw5?
To test the list (to conform to the constraint methods)
T or F: A linked list is a container object made up of 0 or more Nodes.
True
T or F: Any object can be inserted in a polymorphic generic container only when the object satisfies certain constraints.
True
T or F: In our linked list of hw5, the Node objects are all nameless allocated at locations in memory accessible only by starting with a named pointer.
True
T or F: One arrow in the drawing of a linked list is achieved through one line of code in your program.
True
T or F: The List of hw5 is an example of a polymorphic generic container.
True
T or F: The linked-list based Stack of hw5 is an example of a polymorphic generic container.
True
T or F: When called from the List or Node code in hw5, when a constraint method is called, it is called polymorphically.
True
T or F: When drawing linked lists, all arrows that point to the any part of the same Node really point to the upper left corner of that Node.
True
T or F: When drawing linked lists, an arrow that points to the top of the Node really points to the upper left corner of that Node.
True
T or F: When inserting into a doubly linked circular list at the front or at the end of the list, insertion is done between the same two nodes.
True
T or F: When inserting into a doubly linked circular list, the code to insert at the front, end or anywhere in the list is achieved with the same lines of code.
True
T or F: When removing from a doubly linked circular list, the code to remove from the front, end or anywhere in the list is achieved with the same lines of code.
True
T or F: When using a polymorphic generic container, the container can manipulate objects without knowing the types of those objects.
True
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Top assuming Push inserts at the END of the List.
View(this_Stack, END);
Not considering validity checks or other error checking, write the one line of linked list based Stack code to implement Top assuming Push inserts at the FRONT of the List.
View(this_Stack, FRONT);
Which of the four constraint methods of MyRec in hw5 was not found in both driver1 and driver2?
copy myRec
Describe the first lines of code in all constraint methods in hw5.
declaration of local variables of real types
To implement a Queue container using the linked-list of hw5, items are inserted at the ______ of the list and are removed at the ______.
end front
To implement a Stack container using the linked-list of hw5, items are inserted at the ______ of the list and are removed at the ______.
end end (or front front)
What is the name of the design pattern used in hw5 when the linked-list based Stack was implemented via one line methods calling List methods to perform the underlying implementation?
facade
In our linked list of hw5, the manipulations are achieved through __________
function pointers
Considering a tiered or layered design, Stack methods call _______ methods, and Stack methods were called by _______ methods
list driver
When using polymorphic generic containers, an object ___________ when inserted into a container.
loses its identity
The efficiency of the Linked-List based insert function to insert at a selected position in the list is big-O of:
n
The efficiency of the Linked-List based remove function to remove at a selected position in the list is big-O of:
n
The efficiency of the Linked-List based view function to view at a selected position in the list is big-O of:
n
Name of method of MyRec in hw5 that was not a constraint method?
new MyRec
What is the one method of MyRec from hw5 that is not called polymorphically?
new MyRec
In what three areas in the code for hw5 are the constraint methods determined?
new_List, new_Stack, List Definition
Considering a tiered or layered design, List methods call _______ methods, and List methods were called by _______ methods.
node Stack
When using polymorphic generic containers, an object ___________ when removed from a container.
regains its identity
If a user runs driver2, inserts 5 items, and when displayed, the last item inserted is displayed 5 times, what is the likely cause?
storing the pointer and not actually making a copy
In using a polymorphic generic container, the container changes its behavior based on __________
the type of the object it holds
What is the name of the first parameter to most Stack methods of hw5?
this_Stack
In our linked list of hw5, the data is stored using _______
void pointers