Question 1
Questions 1–10 refer to the BankAccount , SavingsAccount , and CheckingAccount classes defined below: public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double acctBalance) { balance = acctBalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public double getBalance() { return balance; } } public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double acctBalance, double rate) { /* implementation not shown */ } public void addInterest() //Add interest to balance { /* implementation not shown */ } } public class CheckingAccount extends BankAccount { private static final double FEE = 2.0; private static final double MIN_BALANCE = 50.0; public CheckingAccount(double acctBalance) { /* implementation not shown */ } /** FEE of $2 deducted if withdrawal leaves balance less * than MIN_BALANCE. Allows for negative balance. */ public void withdraw(double amount) { /* implementation not shown */ } } Of the methods shown, how many different nonconstructor methods can be invoked by a SavingsAccount object?
Correct Answer:
4
Explanation:
Correct answer: 4
Question 2
Questions 1–10 refer to the BankAccount , SavingsAccount , and CheckingAccount classes defined below: public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double acctBalance) { balance = acctBalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public double getBalance() { return balance; } } public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double acctBalance, double rate) { /* implementation not shown */ } public void addInterest() //Add interest to balance { /* implementation not shown */ } } public class CheckingAccount extends BankAccount { private static final double FEE = 2.0; private static final double MIN_BALANCE = 50.0; public CheckingAccount(double acctBalance) { /* implementation not shown */ } /** FEE of $2 deducted if withdrawal leaves balance less * than MIN_BALANCE. Allows for negative balance. */ public void withdraw(double amount) { /* implementation not shown */ } } Which of the following correctly implements the default constructor of the SavingsAccount class? I interestRate = 0; super(); II super(); interestRate = 0; III super();
Correct Answer:
II and III only
Explanation:
Correct answer: II and III only
Question 3
Questions 1–10 refer to the BankAccount , SavingsAccount , and CheckingAccount classes defined below: public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double acctBalance) { balance = acctBalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public double getBalance() { return balance; } } public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double acctBalance, double rate) { /* implementation not shown */ } public void addInterest() //Add interest to balance { /* implementation not shown */ } } public class CheckingAccount extends BankAccount { private static final double FEE = 2.0; private static final double MIN_BALANCE = 50.0; public CheckingAccount(double acctBalance) { /* implementation not shown */ } /** FEE of $2 deducted if withdrawal leaves balance less * than MIN_BALANCE. Allows for negative balance. */ public void withdraw(double amount) { /* implementation not shown */ } } Which is a correct implementation of the constructor with parameters in the SavingsAccount class?
Correct Answer:
super(acctBalance); interestRate = rate;
Explanation:
Correct answer: super(acctBalance); interestRate = rate;
Question 4
Questions 1–10 refer to the BankAccount , SavingsAccount , and CheckingAccount classes defined below: public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double acctBalance) { balance = acctBalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public double getBalance() { return balance; } } public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double acctBalance, double rate) { /* implementation not shown */ } public void addInterest() //Add interest to balance { /* implementation not shown */ } } public class CheckingAccount extends BankAccount { private static final double FEE = 2.0; private static final double MIN_BALANCE = 50.0; public CheckingAccount(double acctBalance) { /* implementation not shown */ } /** FEE of $2 deducted if withdrawal leaves balance less * than MIN_BALANCE. Allows for negative balance. */ public void withdraw(double amount) { /* implementation not shown */ } } Which is a correct implementation of the CheckingAccount constructor? I super(acctBalance); II super(); deposit(acctBalance); III deposit(acctBalance);
Correct Answer:
I, II, and III
Explanation:
Correct answer: I, II, and III
Question 5
Questions 1–10 refer to the BankAccount , SavingsAccount , and CheckingAccount classes defined below: public class BankAccount { private double balance; public BankAccount() { balance = 0; } public BankAccount(double acctBalance) { balance = acctBalance; } public void deposit(double amount) { balance += amount; } public void withdraw(double amount) { balance -= amount; } public double getBalance() { return balance; } } public class SavingsAccount extends BankAccount { private double interestRate; public SavingsAccount() { /* implementation not shown */ } public SavingsAccount(double acctBalance, double rate) { /* implementation not shown */ } public void addInterest() //Add interest to balance { /* implementation not shown */ } } public class CheckingAccount extends BankAccount { private static final double FEE = 2.0; private static final double MIN_BALANCE = 50.0; public CheckingAccount(double acctBalance) { /* implementation not shown */ } /** FEE of $2 deducted if withdrawal leaves balance less * than MIN_BALANCE. Allows for negative balance. */ public void withdraw(double amount) { /* implementation not shown */ } } Which is correct implementation code for the withdraw method in the CheckingAccount class?
Correct Answer:
super.withdraw(amount); if (getBalance() < MIN_BALANCE) super.withdraw(FEE);
Explanation:
Correct answer: super.withdraw(amount); if (getBalance() < MIN_BALANCE) super.withdraw(FEE);
Question 1
Exam overview

About this Exam

The AP Computer Science A exam is a foundational test for high school students aspiring to excel in computer science and object-oriented programming. Unit 9 focuses specifically on inheritance, a critical concept in programming that allows new classes to take on the properties and behaviors of existing classes. This unit is designed for students who want to develop a deep understanding of software design principles, enabling them to create hierarchy and reuse code effectively.

More details

Additional Information

What the Course Entails and Exam Details

Unit 9 dives into several core topics necessary for mastering Java and object-oriented design. The syllabus includes defining superclasses and subclasses, creating subclass objects using constructors, and using the super keyword to invoke superclass constructors and methods. Students will learn about method overriding, understanding dynamic binding and polymorphism, and the significance of the Object class as the root of all Java classes. The course also emphasizes the application of these concepts in various programming scenarios to build robust, scalable applications.


What to Expect in the Final Exam

The final AP Computer Science A exam consists of two sections: Multiple-Choice Questions and Free-Response Questions. Each section is worth 50% of the total score. The multiple-choice section has 40 questions with a time limit of 1 hour and 30 minutes, and the free-response section contains 4 questions with a time limit of 1 hour and 30 minutes. The passing score is typically determined by a curve, with scores ranging from 1 to 5. There are no specific rules regarding aids, but a quick reference guide to Java library methods is provided.


How to Study and Exam Centers

Effective study strategies for Unit 9 involve both theoretical understanding and practical application. Reviewing key concepts and practicing coding are essential. You should work through practice problems from previous AP exams and use online portals like the College Board's AP Classroom for additional resources. Creating your own class hierarchies in Java will reinforce inheritance concepts. The actual AP Computer Science A exam is administered at authorized schools and testing centers. You must check with your AP coordinator for specific details on location and registration.


Job Opportunities from the Course

A strong performance in AP Computer Science A, especially in advanced topics like Unit 9, opens doors to numerous career paths. This certification can unlock several job titles and career opportunities in the technology sector, such as:

  • Software Developer: Design, create, and maintain software applications using object-oriented principles.

  • Computer Programmer: Write and test code for various computer applications and systems.

  • Web Developer: Develop and maintain websites, often utilizing object-oriented backend languages.

  • Systems Analyst: Analyze and design information systems to solve business problems.

  • Software Engineer: Apply engineering principles to the software development lifecycle.

Quiz information

Frequently Asked Questions

The complete question count is available after full access is unlocked.
No fixed duration is currently configured for this quiz.
Question explanations are included where they are available in the quiz content, helping you review the reasoning after answering.
Yes. You can retake the practice test again as you continue studying during your available access period.
After your access is confirmed, you can continue into the complete practice exam from this quiz flow.
Unless explicitly stated otherwise, this page provides independent practice material for study and exam preparation and is not the official examination itself.
Keep studying

Related Questions