AP Computer Science A Unit 9 Progress Check MCQ new solution guide questions and answers 2023
AP Computer Science A Unit 9 Progress Check MCQ new solution guide questions and answers 2023 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? Consider the following class declarations. public class Publication { private String title; public Publication() { title = "Generic"; } public Publication(String t) { 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? 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) { super(); } } public class EvergreenTree extends Tree { public EvergreenTree(String variety) { super(variety); } } The following code segment appears in a method in another class. DeciduousTree tree1 = new DeciduousTree("Maple"); EvergreenTree tree2 = new EvergreenTree("Fir"); Which of the following best describes the result of executing the code segment? Consider the following classes. public class Bird { public void sing() { Sln("Cheep"); } } public class Duck extends Bird { public void sing() { Sln("Quack"); } } public class Chicken extends Bird { // No methods defined } public class Rooster extends Chicken { public void sing() { Sln("Cockadoodle doo"); } } The following statement appears in a method in another class. someB(); Under which of the following conditions will the statement compile and run without error? I. When someBird has been declared as type Duck II. When someBird has been declared as type Chicken III. When someBird has been declared as type Rooster Consider the following class declarations. public class Person { public void laugh() { S("Hahaha"); } } public class EvilPerson extends Person { public void laugh() { S("Mwahahaha"); } } public class Henchman extends EvilPerson { // No methods defined } The following code segment appears in a method in another class. (); Under which of the following conditions will the code segment print "Mwahahaha" ? I. When alice has been declared as type Person II. When alice has been declared as type EvilPerson III. When alice has been declared as type Henchman
Written for
- Institution
- AP Computer Science A Unit 9 Progress Check MCQ
- Course
- AP Computer Science A Unit 9 Progress Check MCQ
Document information
- Uploaded on
- April 2, 2023
- Number of pages
- 15
- Written in
- 2022/2023
- Type
- Exam (elaborations)
- Contains
- Questions & answers
Subjects
-
ap computer science a unit 9 progress check mcq new solution guide questions and answers 2023
-
the following statement appears in a method in another class poodle mydog new poodletoy whic