Exam 3: Implementing Classes
Exam 1: Introduction98 Questions
Exam 2: Using Objects76 Questions
Exam 3: Implementing Classes103 Questions
Exam 4: Fundamental Data Types125 Questions
Exam 5: Decisions120 Questions
Exam 6: Loops128 Questions
Exam 7: Arrays and Array Lists118 Questions
Exam 8: Designing Classes95 Questions
Exam 9: Inheritance101 Questions
Exam 10: Interfaces85 Questions
Exam 11: Inputoutput and Exception Handling109 Questions
Exam 12: Object-Oriented Design104 Questions
Exam 13: Recursion110 Questions
Exam 14: Sorting and Searching109 Questions
Exam 15: The Java Collections Framework110 Questions
Exam 16: Basic Data Structures104 Questions
Exam 17: Tree Structures110 Questions
Exam 18: Generic Classes75 Questions
Exam 19: Graphical User Interfaces76 Questions
Exam 20: Streams and Binary Inputoutput82 Questions
Exam 21: Multithreading82 Questions
Exam 22: Internet Networking74 Questions
Exam 23: Relational Databases75 Questions
Exam 24: XML74 Questions
Exam 25: Web Applications75 Questions
Select questions type
Instance variables that are numbers are initialized to what default value?
Free
(Multiple Choice)
4.9/5
(40)
Correct Answer:
C
We want to change the BankAccount class so that all accounts will have a monthly fee. When a BankAccount is created, its monthly fee is set and cannot be changed. The instance variable monthlyFee will hold the monthly fee. Which of the following methods deducts the value of the monthly fee from the account?
Free
(Multiple Choice)
4.7/5
(47)
Correct Answer:
A
A class declaration consists of which of the following parts?
Free
(Multiple Choice)
4.9/5
(38)
Correct Answer:
A
What is the name of the constructor for the BankAccount class?
(Multiple Choice)
4.9/5
(35)
Assuming the following code is the body of the deposit method, what output is generated by the valid call myAccount.deposit(1000) for an account with an initial balance of 500? public void deposit(double amount)
{
System.out.println(amount);
Double newBalance = balance + amount;
Balance = newBalance;
}
(Multiple Choice)
4.9/5
(28)
What is the return type of the println method of the PrintStream class?
(Multiple Choice)
4.9/5
(31)
Consider the following code to declare a constructor for the Player class: public void Player(String playerName)
{
Name = playerName;
}
Which statement is true?
(Multiple Choice)
4.7/5
(31)
Which statement is true about the following constructor of the BankAccount class? public BankAccount(double balance)
{
This.balance = balance;
}
(Multiple Choice)
4.8/5
(40)
When drawing complex shapes, provide a(n) ____ to set the position of the shape.
(Multiple Choice)
4.9/5
(45)
Which of the following statements is true about constructors?
(Multiple Choice)
4.7/5
(29)
Which of the following corresponds to the getArea method body for a Square class where the instance variable is named sideLength?
(Multiple Choice)
4.8/5
(26)
Which of the following corresponds to a valid constructor header for the Player class?
(Multiple Choice)
4.8/5
(37)
What is the name of the local variable of the giveChange method of the CashRegister class?
(Multiple Choice)
4.9/5
(31)
What will be output from the following statements that use BankAccount class? BankAccount first = new BankAccount (100);
First.deposit (50.0);
BankAccount second = new BankAccount (first.getBalance());
First.deposit (50.0);
BankAccount third = new BankAccount (first.getBalance());
First.deposit (50.0);
System.out.println (first.getBalance() + " "
+ second.getBalance() + third.getBalance());
(Multiple Choice)
4.9/5
(40)
What contains the instructions to initialize the instance variables of an object?
(Multiple Choice)
4.7/5
(48)
Consider the following method comment and method header: /**
Converts from a source measurement to a target measurement.
@param _______________ the measurement
@return the input value converted to the target unit
*/
Public double convertTo(double fromMeasurement) { . . . }
Fill in the blank.
(Multiple Choice)
4.8/5
(41)
Showing 1 - 20 of 103
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)