Docsity

Data Structures and UML Diagrams Review, Exams of Computer Science

Toggle sidebar
bg1
CPSC 210 - Midterm 2 Questions with
complete solution 2025
Sequence Diagram - correct answer One with lifelines and each object
UML diagram - correct answer Tree-like representation of relationship
between classes (check fields) then check body for associations
Map - correct answer Map<key, value> newMapCreation = new HashMap<>;
Adding something to a Map - correct answer this.BLANK.put(key,value);
testing exceptions - correct answer Should leave blanks where the right thing
is happening and include all the asserts after the try catch blocks
Extends Arrow - correct answer straight arrow with open arrow head
Implements Arrow - correct answer dotted with open arrow head
Association arrow has a field of B - correct answer straight line normal arrow
head with 1
Associate of a list of B - correct answer straight line normal arrow head with
0..* or 1...* depending on if list is initialized with one item or null
Aggregation (A is a part of B ) - correct answer diamond at bottom of arrow
pf3

Partial preview of the text

Download Data Structures and UML Diagrams Review and more Exams Computer Science in PDF only on Docsity!

CPSC 210 - Midterm 2 Questions with

complete solution 2025

Sequence Diagram - correct answer One with lifelines and each object UML diagram - correct answer Tree-like representation of relationship between classes (check fields) then check body for associations Map - correct answer Map<key, value> newMapCreation = new HashMap<>; Adding something to a Map - correct answer this.BLANK.put(key,value); testing exceptions - correct answer Should leave blanks where the right thing is happening and include all the asserts after the try catch blocks Extends Arrow - correct answer straight arrow with open arrow head Implements Arrow - correct answer dotted with open arrow head Association arrow has a field of B - correct answer straight line normal arrow head with 1 Associate of a list of B - correct answer straight line normal arrow head with 0..* or 1...* depending on if list is initialized with one item or null Aggregation (A is a part of B ) - correct answer diamond at bottom of arrow

Array List fast at?? - correct answer add fast? add(i) slow get (I) fast remove (i) slow Linked List fast at?? - correct answer add fast add(i) slow get I slow remove I slow List properties - correct answer Keeps order and allows duplicates Set properties - correct answer Doesn't keep order Doesn't allow duplicates Hash Set Fast? - correct answer add e remove e printing keys - correct answer map.keySet(); getting value - correct answer map.get("key") overidinf hash code - correct answer @Overridepublic boolean equals(Object o) {if (this == o) return true; if (o == null || getClass() != o.getClass()) return