Question: 1-Consider this code: j.addEventHandler(MouseEvent.MOUSE_EXITED, e->{ // [ lines omitted ] }); This code contains a(n) a.Static declaration b.Native method c.Immutable data structure d.Lambda expression e.Recursive
1-Consider this code:
j.addEventHandler(MouseEvent.MOUSE_EXITED, e->{
// [ lines omitted ] });
This code contains a(n)
a.Static declaration b.Native method c.Immutable data structure d.Lambda expression e.Recursive call
2-A Java interface can contain
a.Method headers that require implementing classes to provide corresponding methods b.Instance Variables c.Code to implement methods d.Final values (constants)
3-Consider the JavaFX methods addEventHandler() and Application.launch() (the method you call if your JavaFX Application contains a main()) Which of the following is correct?
a.addEventHandler() is a static method and Application.launch() is an instance method b.addEventHandler() and Application.launch() are both static methods c.addEventHandler() is an instance method and Application.launch() is a static method d.addEventHandler() and Application.launch() are both instance methods
4-Suppose Gizmo is a Java interface, PlasmaGizmo is an abstract class that implements Gizmo, and TypeBPlasmaGizmo is a concrete class that extends PlasmaGizmo. Which of the following is/are correct?
a.It is possible to instantiate an ArrayList parameterized by Gizmo b.It is possible to instantiate an ArrayList parameterized by PlasmaGizmo c.It is possible to instantiate an ArrayList parameterized by TypeBPlasmaGizmo d.It is possible to instantiate an object of class Gizmo e.It is possible to instantiate an obejct of class PlasmaGizmo
5-Suppose Sheep exhibit different behavior according to the number of Sheep that have been instantiated in the application. One Sheep wanders around at random, two Sheep face in opposite directions to watch for predators, and three or more Sheep organize themselves in a circular herd with the larger animals towards the outside and the juveniles on the inside. All of this behavior is coded in the Sheep class. What is the best way to keep track of the number of Sheep in the application?
a.Use a lambda expression b.Instantiate the Sheep using an implicit constructor c.Use a static variable d.Use an instance variable e.Save each Sheep to a file using text I/O and read the files when the Sheep need to decide what to do
6-Suppose you are writing an application that will model bank accounts. The two types of account, SavingsAccount and CheckingAccount, each have balances, account owners, and account numbers as well as getters and setters for these values. SavingsAccount also has a method, run daily, that calculates interest on the account. Which of the following is the best alternative?
a.Override the calcInterest() method from String b.Use a single class, include the calcInterest() method, and just dont use it with checking accounts c.Both CheckingAccount and SavingsAccount are concrete classes that extend the abstract class Account d.Both CheckingAccount and SavingsAccount are abstract classes, which are extended by the concrete classes ConcreteCheckingAccount and Concrete SavingsAccount e.Both CheckingAccount and SavingsAccount implement the interface Account
7-Suppose Bar is a Java interface and BigBar and GinormousBar are concrete classes that implement Bar. Our application contains this line of code:
List
Which of the following is/are possible?
a.Instantiate a Bar and add it to the list b.Instantiate a BigBar and add it to the list c.Instantiate a GinormousBar and add it to the list d.Create a class that extends both BigBar and GinormousBar
8-Which of the following statements about binary file I/O is FALSE?
a.It allows an application to read and write entire objects to and from files b.It uses a plain text file format c.It requires casting objects when they are read from files d.It makes parsing code unnecessary e.The Java code to implement it is platform-independent
9-Consider this code:
EventHandler
@Override public void handle(InputEvent event) { wall = toggleWall(j, wall, row, col); } };
This code contains a(n)
a.Lambda expression b.Anonymous class c.Recursive method call d.Static method
10-Consider this diagram:
This is a
a.Class Diagram b.State Diagram c.State diagram d.Interaction Diagram e.Sequence Diagram
Person Address Street City State Postal Code Country Validate Output As Label Name Phone Number Email Address 0..1 lives at Purchase Parking Pass Student Professor Salary Student Number Average Mark s Eligible To Enrol Get Seminars TakenStep by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
