CMSC 132 - Exam 2 Lectures(All solved)
(T/F) Type parameters work with arrays without need for adjustment correct answers FALSE Correct type parameter implementation for an array correct answers private T[] b = (T[])new Object[]; Subtype correct answers "Is-A" of all things above Code to restrict type parameter "T" to something that extends "Foo" correct answers T extends Foo (T/F) Using generics in collections works with polymorphism correct answers FALSE Definition of "Ordered" correct answers can tell first from last Definition - List Head correct answers First element Definition - List Tail correct answers Last element Definition - List Predecessor correct answers Element before current Definition - List Successor correct answers Element after current The two types of Java Lists correct answers 1. Array 2. Linked List 5 Cases to consider for operations on a Linked List correct answers Works if... 1. List is empty 2. List has only one element 3. Operation occurs at head 4. Operation occurs in "middle" 5. Operation occurs at tail (T/F) Linked List random access is the same as Array Random access correct answers FALSE Advantages of Doubly Linked List over Singly correct answers - Backwards iteration - Delete at tail is faster Disadvantages of Doubly Linked List over Singly correct answers - Slower 4 Types of Linear Data Structures you implement with a Linked List correct answers - List - Stack - Queue
Document information
- Uploaded on
- May 29, 2024
- Number of pages
- 2
- Written in
- 2023/2024
- Type
- Exam (elaborations)
- Contains
- Questions & answers