Free Exam: APCS Ch. 9 Quiz
Number of Questions in Test: 19
Number of Questions in Preview: 5
Register to view all questions.
Note: Answers are not shown below but will be copied with this test.
Copy this test to my quiz maker account
Register with ClassMarker to copy free tests to give to your Test takers.
Register nowQuestion 1
Which of the following is a [b]primary[/b] benefit of [b]inheritance[/b]?
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | Yes |
Question 2
One way of preventing a class from being inherited is to declare the class as:
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | Yes |
Question 3
You can specify only one superclass for any subclass you create ("single inheritance")
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | Yes |
Question 4
Which of the following is/are true regarding [b]abstract[/b] [b][i]methods[/i][/b]?
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |
Question 5
[b]Refer to the following partial class definitions for this question:[/b]
[b]public abstract class Account[/b]
{ public [b]Account[/b]() { ... }
}
[b]public class BankAccount extends Account[/b]
{ private double balance;
[b]public BankAccount (double amount)[/b]
{ super();
balance = amount;
}
}
[b]public class CheckingAccount extends BankAccount[/b]
{ private String customerName;
public [b]CheckingAccount [/b](String name, double amount)
{
[b][i]<Missing statements>[/i][/b]
}
...
}
Which of the following is an acceptable replacement for [b][i]<Missing statements>[/i][/b] in CheckingAccount's constructor?
I)[size=4] [/size][size=3] [/size]balance = amount;
customerName = name;
II)[size=4] [/size]super(amount);
customerName = name;
III)[size=4] [/size][size=4] [/size]super (name, amount);
[b]public abstract class Account[/b]
{ public [b]Account[/b]() { ... }
}
[b]public class BankAccount extends Account[/b]
{ private double balance;
[b]public BankAccount (double amount)[/b]
{ super();
balance = amount;
}
}
[b]public class CheckingAccount extends BankAccount[/b]
{ private String customerName;
public [b]CheckingAccount [/b](String name, double amount)
{
[b][i]<Missing statements>[/i][/b]
}
...
}
Which of the following is an acceptable replacement for [b][i]<Missing statements>[/i][/b] in CheckingAccount's constructor?
I)[size=4] [/size][size=3] [/size]balance = amount;
customerName = name;
II)[size=4] [/size]super(amount);
customerName = name;
III)[size=4] [/size][size=4] [/size]super (name, amount);
Type: | Multiple choice |
Points: | 1 |
Randomize answers: | No |