← Skill tree CS Skill Tree 0 CSCD210

Quiz W1: CSCD 210 Prerequisite Diagnostic

Textbook: BJP (Reges and Stepp)

Where you are: Week 0 review > Prerequisite diagnostic

This short self-check covers the four CSCD 210 ideas that Week 1 leans on most: the difference between == and .equals, how an assignment copies a reference and not the object, the sign contract of compareTo, and writing a one-line compareTo without subtraction.

It is low-stakes by design. The point is to find any gap now, before new material depends on it. If a question stumps you, the matching week-0 review lesson covers it: References, ==, and aliasing, equals and hashCode, and Comparable and compareTo. Answer each from memory first, then reveal it.

Check Yourself

Check your understanding

True or False: two String variables s1 and s2 that both hold the value “hello” are guaranteed to make s1 == s2 return true.

Tier 1 · COMPETENCY-RECONCILIATION Area 3 CORE (== identity vs equals content); BJP (Reges and Stepp), Ch 8-9

True or False: when you write Cat b = a; (a is already a Cat), Java creates a second independent Cat object named b.

Tier 1 · COMPETENCY-RECONCILIATION Area 3 CORE (reference copy on assignment); BJP (Reges and Stepp), Ch 8

True or False: implementing compareTo by returning this.age - other.age is always safe when age is a positive int field.

Tier 2 · COMPETENCY-RECONCILIATION Area 3 CORE (delegate to Integer.compare to avoid overflow); BJP (Reges and Stepp), Ch 10

A class implements Comparable<Product>. The compareTo method returns what sign when this product orders BEFORE other, when the two are EQUAL in ordering, and when this product orders AFTER other?

Tier 2 · COMPETENCY-RECONCILIATION Area 3 CORE; clos.yaml CLO-09 enabling prerequisite; BJP (Reges and Stepp), Ch 10

A class Song has one int field year and declares implements Comparable<Song>. Write the single return statement that completes compareTo(Song other), ordering by year ascending, with no subtraction.

Tier 3 · cscd211 sample exam 2 item 15 (compareTo cascade); COMPETENCY-RECONCILIATION Area 3 CORE; BJP (Reges and Stepp), Ch 10