1. (TCO 7) Which of the following statements
are true? (Points : 5)
Interfaces contain one and only one implemented method, a
constructor.
Interfaces are defined inside
an abstract class.
All methods defined in an
interface must be implemented when used by another class.
A true object-oriented design
must contain as least one interface.
abstract class; interface interface; base class None of the above |
object hierarchies instantiated classes contracts None of the above |
B. Programming to an interface makes the code more logical. Both A and B None of the above |
Code markers should be used to show what the developer still needs to do Comments showing the intent of the code All of the above None of the above |
Using namespaces as a container for logically related items Using namespaces to create global types All of the above None of the above |
3 5 4 |
void GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (int favoriteColor){this.favoriteColor = favoriteColor;} string GetFavoriteColor (){return favoriteColor;}, void SetFavoriteColor (string favoriteColor){this.favoriteColor = favoriteColor;} string GetFavoriteColor (){this.favoriteColor = favoriteColor;}, void SetFavoriteColor (string favoriteColor){return favoriteColor;} |
| Question 9. 9. (TCO 7) Which of the following declares an abstract method in an abstract class? (Points : 5) |
public abstract void
DisplayResult();
public void abstract
DisplayResult();
public void
DisplayResult{};
public abstract void
DisplayResult() {}
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
1. (TCO 7) Which of the following statements are true? (Points : 5) Interfaces contain...
Which of the following is true about interfaces: An interface can have only non abstract methods. All methods in an interface must be abstract. A class can only implement one interface. None of the items listed. Can not contain constants but can have variables. What is the rule for a super reference in a constructor? It must be in the parent class' constructor. You cannot use super in a constructor. It must be the last line of the constructor in...
Abstract classes and Interfaces problems 10. Explain one similarity and one difference between abstract classes and interfaces. 11. Consider the following declarations. public interface Shape{ int someFunction(Shape other); //other functions not shown } public class Square implements Shape {/*implementation not shown*/} Which of the following function headings of someFunction must be added to the declaration of the Square class such that it will satisfy the Shape interface? public int someFunction (Shape other) public int someFunction (Square other) public boolean someFunction(Object...
Abstract classes and Interfaces problems 10. Explain one similarity and one difference between abstract classes and interfaces. 11. Consider the following declarations. public interface Shape{ int someFunction(Shape other); //other functions not shown } public class Square implements Shape {/*implementation not shown*/} Which of the following function headings of someFunction must be added to the declaration of the Square class such that it will satisfy the Shape interface? public int someFunction (Shape other) public int someFunction (Square other) public boolean someFunction(Object...
1. Which of the following statements is true? I. When an object is serialized, all of its data attributes are always serialized. II. When an object is serialized, its methods are not serialized. III. The Serializable interface does not declare any abstract methods. Select one: A. I only B. II only C. III only D. I and II only E. II and III only 2. For the code below, and assuming widget.dat exists, which of the following statements are false?...
Some Java help please 1. ) Which of the following statements is not true? A. All the methods in an interface are abstract B. A class can implement just the methods of an interface it needs C. An interface can contain static constants D. C class can implement multiple interfaces. 2. ) Which method is an example of overriding the method that follows? public int parseNumber(String numberString){...} A. public double parseNumber(String numberString){...} B. public int parseNumber(String num){...}
In this lab you will work with abstract classes/interfaces. (Java Program) You will be implementing a basic employee schema within a company. The Employee class will be an abstract class that will contain methods applicable to all employees. You will then create 2 classes called SoftwareEngineer and ProductManager. Both are different employee types based on occupation. You will create an interface called Developer which will consist of specific methods that apply to only Developers (e.g. SoftwareEngineer class will implement this,...
Rewrite the Course class in Listing 10.6 to implement the comparable and the cloneable interfaces. The clone method must allow a deep copy on the students field. In addition, add the equals(Object o) and the toString() methods. Write a test program to invoke the compareTo, clone, equals, and toString methods in a meaningful way. Below is the Listing from the book that needs to be rewritten public class Course { private String courseName; private String[] students = new...
Code the following interfaces - An interface called Accountable with void withdraw(double) and double getPayment() methods, and an interface called AccountReceivable with a void deposit(double) method. Save these two interfaces in separate Java files. Then code a class, BusinessAccount, that implements the two interfaces defined above. Define and code the necessary instance variables and constructors. Override toString() so it will return the amount of a business account. Apply the particular operations, such as withdraw and deposit, required in implementing the...
Question 116 pts (TCO 2) What is the output of the following code? void func(int x) { x = x * 2; } int main( ) { int x = 10; func(x); cout << x << endl; } 20 30 10 5 Question 126 pts (TCO 2) A derived class is typically an example of _____. a “has a” relationship an “is a” relationship a “uses a” relationship an “is used” relationship Question...
Question 1 1 pts Which of the following is not a valid class name in Java? O MyClass MyClass1 My_Class MyClass# Question 2 1 pts Which of the following statements is False about instance variables and methods? Instance variables are usually defined with private access modifier. Instance variables are defined inside instance methods. Instance methods are invoked on an object of the class that contains the methods. A class can have more than one instance variables and methods. Question 3...