Multiple choice technology programming languages

Class Foo{ Int num; Baz comp=new Baz(); } Class Bar{ Boolean flag; } Class Baz extends Foo{ Bar thing=new Bar(); Double limit; }

  1. A Bar is a Baz

  2. A Foo has a Bar

  3. A Baz is a Foo

  4. A Foo is a Baz

  5. A Baz has a Bar

Reveal answer Fill a bubble to check yourself
C,E Correct answer
Explanation

Baz extends Foo, so every Baz object is also a Foo through inheritance (is-a relationship). Baz contains a Bar field named 'thing', so a Baz has-a Bar. Option C correctly states the inheritance relationship, and E correctly states the composition relationship.