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

Prepare with the AP Computer Science Unit 9 Test Review Practice Questions practice quiz. This question bank includes 20 questions covering public, double, balance, bankaccount, and implementation. Use it to review important concepts, identify knowledge gaps, and build confidence for the related exam, course, or assessment.

More details

Additional Information

AP Computer Science Unit 9 Test Review Practice Questions

This practice set contains 20 questions from the matching question bank and focuses on public, double, balance, bankaccount, and implementation. Work through each question carefully, review the provided solutions, and revisit topics that need more study before your next attempt.

This is an independent study resource intended for practice and review; it is not an official examination or an endorsement by any organization named in the title.

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