Exam 6: A First Look at Classes
Exam 1: Introduction to Computers and Java51 Questions
Exam 2: Java Fundamentals61 Questions
Exam 3: Decision Structures64 Questions
Exam 4: Loops and Files57 Questions
Exam 5: Methods60 Questions
Exam 6: A First Look at Classes58 Questions
Exam 7: Arrays and the Arraylist Class64 Questions
Exam 8: A Second Look at Classes and Objects50 Questions
Exam 9: Text Processing and More About Wrapper Classes60 Questions
Exam 10: Inheritance70 Questions
Exam 11: Exceptions and Advanced File IO56 Questions
Exam 12: A First Look at GUI Applications60 Questions
Exam 13: Advanced GUI Applications58 Questions
Exam 14: Applets and More54 Questions
Exam 15: Creating GUI Applications With Javafx and Scene Builder40 Questions
Exam 16: Recursion42 Questions
Exam 17: Databases48 Questions
Select questions type
Look at the following statement. import java.util.Scanner;
This is an example of
Free
(Multiple Choice)
4.7/5
(36)
Correct Answer:
B
A constructor is a method that is automatically called when an object is created.
Free
(True/False)
4.7/5
(48)
Correct Answer:
True
When a local variable in an instance method has the same name as an instance field, the instance field hides the local variable.
Free
(True/False)
4.8/5
(29)
Correct Answer:
False
For the following code, which statement is NOT true?
Public class Sphere
{
Private double radius;
Public double x;
Private double y;
Private double z;
}
(Multiple Choice)
5.0/5
(42)
Shadowing is the term used to describe where the field name is hidden by the name of a local or parameter variable.
(True/False)
4.8/5
(44)
Instance methods do not have this key word in their headers:
(Multiple Choice)
4.9/5
(37)
Which of the following is NOT involved in finding the classes when developing an object-oriented application?
(Multiple Choice)
4.9/5
(36)
What does the following UML diagram entry mean?
+ setHeight(h : double) : void
(Multiple Choice)
4.9/5
(41)
Which of the following statements will create a reference, str, to the string, "Hello, world"?
(1) String str = new String("Hello, world");
(2) String str = "Hello, world";
(Multiple Choice)
4.8/5
(40)
Given the following code, what will be the value of finalAmount when it is displayed?
Public class Order
{
Private int orderNum;
Private double orderAmount;
Private double orderDiscount;
Public Order(int orderNumber, double orderAmt,
Double orderDisc)
{
OrderNum = orderNumber;
OrderAmount = orderAmt;
OrderDiscount = orderDisc;
}
Public int getOrderAmount()
{
Return orderAmount;
}
Public int getOrderDisc()
{
Return orderDisc;
}
}
Public class CustomerOrder
{
Public static void main(String[] args)
{
Int ordNum = 1234;
Double ordAmount = 580.00;
Double discountPer = .1;
Order order;
Double finalAmount = order.getOrderAmount() -
Order.getOrderAmount() * order.getOrderDisc();
System.out.printf("Final order amount = $%,.2f\n",
FinalAmount);
}
}
(Multiple Choice)
4.9/5
(30)
Instance methods do not have the key word static in their headers.
(True/False)
4.8/5
(40)
Class objects normally have ________ that perform useful operations on their data, but primitive variables do not.
(Multiple Choice)
4.9/5
(30)
You should not define a class field that is dependent upon the values of other class fields:
(Multiple Choice)
5.0/5
(40)
After the header, the body of the method appears inside a set of:
(Multiple Choice)
4.9/5
(35)
Showing 1 - 20 of 58
Filters
- Essay(0)
- Multiple Choice(0)
- Short Answer(0)
- True False(0)
- Matching(0)