Question: Data Structures in JAVA questions Multiple Choice For each question, select the best answers that apply. More than one answer can be circled and D
Data Structures in JAVA questions
Multiple Choice
For each question, select the best answers that apply. More than one answer can be circled and D is always going to be None of the above. This means no question will have multiple answers with D selected (such as A and D). The minimum to circle is at least one answer and the most would be A, B and C.
Which of the following statements is/are true about Big-O?
Big-O measures the performance of your algorithm as the number of elements in the data set it is working with increases in size
One example of an O(n) algorithm is that if a list has 1000 elements performing 2000 comparisons, then if the list had 3000 elements, it would perform about 4000 comparisons
If algorithm 1 performs at a better Big-O category than algorithm 2, then algorithm 1 will eventually have better performance than algorithm 2 as more items are added to the data structure
None of the above
With a stack implemented as a linked list, which of the following is true?
Push performs at O(1) when the append function for a linked list is used
Pop performs at O(1) when the general delete function for a linked list is used
Top (looking at whats on top of the stack) performs at O(n) when showing what the head node value is
None of the above
Which of the following is true about using a 2-3-4 tree?
The purpose of using a 2-3-4 tree is to ensure that the tree structure is balanced no matter how many inserts are performed
If delete is handled by marking data items as deleted, then the algorithm to remove all elements marked for deletion and rebuilding the tree is O(n)
The split function is performed during insert when a leaf node is visited and its data items list is full
None of the above
Which of the following is true when comparing arrays and linked lists?
With sorted data, delete between the 2 data structures performs in the same O category in the worst case
One of the advantages with arrays over linked lists is dynamic memory usage
If the data is unsorted, append between the 2 data structures performs in the same O category in the worst case
None of the above
Which of the following is true about the delete function of a binary search tree?
If the node to delete has two children, the successor node is found by looking for the smallest value in the right subtree of the node to be removed
If the node is found to delete, the node to delete will be in 1 of 3 unique situations: one child, two children or is a leaf
The delete function will perform at O(n) if all the elements of the tree only have child nodes on the right
None of the above
Which of the following is true about how recursion functions work?
If you think of the function execution performing like a loop, the base case represents the condition where if true, the loop stops
The inductive case is where the code calls another function that contains a loop
Recursive functions never have any input parameters in the function signature
None of the above
Which of the following is true about the sorting algorithms?
Insertion sort and Selection sort in the worst case perform with the same number of comparisons
For randomized data elements, Merge sort and Quick sort perform at the same Big-O category of performance
Insertion sort is better than quick sort if the data nearly sorted in reverse order
None of the above
O(n) is the performance in the worst case for which of the following functions in a sorted array?
Binary search
Update
Delete
None of the above
Which of the following is true about hash tables?
Separate chaining with a linked list for collision handling requires creating at least 2 hash functions
The goal for using hash tables is to optimize on search at the sacrifice of static memory usage and ease of displaying all elements in sorted order
Deleting an element using linear probing for collision handling requires the use of a linked list
None of the above
Which of the following is true with the pros and cons of data structures?
Arrays benefits is static memory usage but the con is direct access to any data set element
Binary tree search is O(log n) but the tree has to balanced
Priority queues are O(1) for insert and remove, but they have to be implemented as a linked list
None of the above
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
