Please log in to purchase this document.

AP Computer Science A Unit 9 Progress

EXAM ELABORATIONS Aug 28, 2025
Loading...

Loading document viewer...

Page 0 of 0

Document Text

AP Computer Science A Unit 9 Progress

Check: MCQ

Consider the following class declarations.public class Dog { private String name; public Dog() { name = "NoName"; } } public class Poodle extends Dog { private String size; public Poodle(String s) { size = s; } } The following statement appears in a method in another class.Poodle myDog = new Poodle("toy"); Which of the following best describes the result of executing the statement? Ans- B. The Poodle variable myDog is instantiated as a Poodle. The instance variable size is initialized to "toy". An implicit call to the no-argument Dog constructor is made, initializing the instance variable name to "NoName".Consider the following class declarations.public class Publication { private String title; public Publication() { title = "Generic"; } public Publication(String t) 1 / 2

{ title = t; } } public class Book extends Publication { public Book() { super(); } public Book(String t) { super(t); } } The following code segment appears in a method in another class.Book myBook = new Book("Adventure Story"); // Line 1 Book yourBook = new Book(); // Line 2 Which of the following best describes the result of executing the code segment? Ans- C.Object myBook is created using the one-argument Book constructor, which uses super to set myBook's title attribute to "Adventure Story". Object yourBook is created using super to call to the Publication no-argument constructor to set yourBook's title attribute to "Generic".Consider the following class declarations.public class Tree { private String treeVariety; public Tree() { treeVariety = "Oak"; } public Tree(String variety) { treeVariety = variety; } } public class DeciduousTree extends Tree { public DeciduousTree(String variety) {

  • / 2

Download Document

Buy This Document

$30.00 One-time purchase
Buy Now
  • Full access to this document
  • Download anytime
  • No expiration

Document Information

Category: EXAM ELABORATIONS
Added: Aug 28, 2025
Description:

AP Computer Science A Unit 9 Progress Check: MCQ Consider the following class declarations. public class Dog { private String name; public Dog() { name = "NoName"; } } public class Poodle extends D...

Get this document $30.00