Question
A) Which statement(s) is/are false ? 1.Bit representation of floating point numbers sometimes contains error 2.The number of real numbers is finite 3.The number of
A) Which statement(s) is/are false?
1.Bit representation of floating point numbers sometimes contains error 2.The number of real numbers is finite 3.The number of bits we can use to represent a value is infinite 4.It is possible to represent an every real number with a finite number of bits without error 5.The number of values we can represent using a finite number of bits is finite
B)Consider this method:
public String getName(){
return name;
}
Which of the following is/are false?
1.This method returns a String 2.This is a constructor 3.This is a mutator 4.This is a concrete method
C)Consider this code:
public class Clown extends Monster { private double shoeSize;
public Clown(double shoeSize){ this.shoeSize = shoeSize; } }
What does the method Clown return?
1.A copy of a String 2.A reference to a String 3.A copy of a Clown 4.A reference to a Clown 5.Nothing
D) Using public getters and setters with private data variables is a way to achieve
1.exception handling 2.type erasure 3.polymorphism 4.encapsulation
E) Suppose Monitor and SmartTV are both concrete classes that implement the interface Screen. Which of the following is/are possible?
1.Instantiate a List of Monitors 2.Add a SmartTV to an array of Screens 3.Instantiate an object of class Screen 4.Add a Monitor to a List of Screens 5.Add a Monitor to a List of SmartTVs
F) Suppose the classes ScaryClown and FunnyClown implement the interface Clown. Which of the following is correct?
1.ScaryClown and FunnyClown are superclasses of Clown 2.FunnyClown extends ScaryClown 3.A list parameterized by Clown can contain any mixture of FunnyClowns and ScaryClowns 4.FunnyClown is a subclass of Clown 5.Clown implements ScaryClown
G) Suppose Vampire and Werewolf are two concrete classes that implement the interface Monster. Which statement(s) is/are false?
1.We can use a variable of type Monster to add a Vampire to a list parameterized by Monster 2.A list of Monsters may only contain objects of class Monster 3.We can create a list parameterized by Monster and add any combination of Vampires and Werewolves to it 4.We can instantiate objects of class Monster and add them to a list of Vampires 5.Any method that is required by the Monster interface can be called by using a variable that is a reference to a Werewolf
H) Which statement(s) is/are false?
1.Concrete classes can declare static variables 2.Java interfaces contain implicit constructors 3.Abstract classes can contain concrete methods 4.Concrete classes can contain static methods 5.Java Interfaces can contain concrete methods
I) Suppose you are writing an application that will keep track of university courses using a CollegeAdministration class that contains an ArrayList of Courses. Undergraduate courses and graduate courses need methods to handle exam administration and grading. Both administerExam() and grade() methods will work differently for the two types of Courses. Which of the following approaches is best?
1.Course is a Java interface implemented by two classes 2.Course is an abstract class extended by two subclasses 3.UndergraduateCourse and GraduateCourse are two unrelated classes 4.Course is a concrete class with a boolean variable that will be true for undergraduate courses and false for graduate courses 5.UndergraduateCourse and GraduateCourse are both interfaces implemented by concrete classes
J) Suppose you are writing an application that will be used to control generators. Each type of Generator a generate() method, which works differently for PropaneGenerators and DieselGenerators. Each type also has an emergencyStop() method, which works the same way for both types of Generator. Which of the following approaches is best?
1.PropaneGenerator and DieselGenerator each implement the Java interface Generator 2.PropaneGenerator and DieselGenerator are interfaces, each with an implementing class 3.PropaneGenerator and DieselGenerator are two unrelated classes 4.PropaneGenerator and DieselGenerator each extend the concrete class Generator 5.PropaneGenerator and DieselGenerator each extend the abstract class Generator
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started