java programming Question 1 (1 point) A JavaFX action event handler is an instan
ID: 3808363 • Letter: J
Question
java programming
Question 1 (1 point)
A JavaFX action event handler is an instance of ________.
Question 1 options:
Save
Question 2 (1 point)
Suppose A is an inner class in Test. A is compiled into a file named ________.
Question 2 options:
Save
Question 3 (1 point)
Which statement is true about a non-static inner class?
Question 3 options:
Save
Question 4 (1 point)
Suppose A is an anonymous inner class in Test. A is compiled into a file named ________.
Question 4 options:
Save
Question 5 (1 point)
A JavaFX action event handler contains a method ________.
Question 5 options:
Save
Question 6 (1 point)
A JavaFX event handler for event type T is an instance of ________.
Question 6 options:
Save
Question 7 (1 point)
To register a source for an action event with a handler, use ________.
Question 7 options:
Save
Question 8 (1 point)
Which of the following statements is true?
Question 8 options:
Save
Question 9 (1 point)
Which of the following statements is true?
Question 9 options:
Save
Question 10 (1 point)
Which of the following statements is not true?
Question 10 options:
Save
Question 11 (1 point)
Which of the following statements is not true?
Question 11 options:
Save
Question 12 (1 point)
Which of the following statements is not true?
Question 12 options:
Save
Question 13 (1 point)
Which of the following code correctly registers a handler with a button btOK?
Question 13 options:
Save
Question 14 (1 point)
The propertiy ________ is not defined in the PathTransition class.
Question 14 options:
Save
Question 15 (1 point)
________ is not a subclass of Animation.
Question 15 options:
Save
Question 16 (1 point)
Which statement cannot be used to fill in the code to display the key pressed in the text.
Text text = new Text(20, 20, "Welcome");
text.setFocusTraversable(true);
text.setOnKeyPressed(________);
Question 16 options:
Save
Question 17 (1 point)
What is the output of the following code:
DoubleProperty balance = new SimpleDoubleProperty();
balance.addListener(ov ->
System.out.println(2 + balance.doubleValue()));
balance.set(4.5);
Question 17 options:
Save
Question 18 (1 point)
Analyze the following code segment.
Button btOK = new Button("OK");
Button btCancel = new Button("Cancel");
EventHandler<ActionEvent> handler = new EventHandler<ActionEvent>() {
public void handle(ActionEvent e) {
System.out.println("The OK button is clicked");
}
};
btOK.setOnAction(handler);
btCancel.setOnAction(handler);
Question 18 options:
Save
Question 19 (1 point)
True of false?
An inner class can be used to provide the event hander method
Question 19 options:
Save
Question 20 (1 point)
True of false?
An annonymous class can be used to provide the event hander method
Question 20 options:
A) EventHandler<ActionEvent> B) EventHandler C) ActionEvent D) ActionExplanation / Answer
Solution:
JavaFx action event handler is an instance of ActionEvent. JavaFx classes are not part of the java collection framework. ActionEvent is class it extends the Event Class. Action Event is used to perform different operations like Button is clicked and other similar uses.
Thus the Correct option is (C) itself.
(2) Suppose A is an inner class in Test. A is compiled into a file named ________.
(A) A$Test.class
(B) Test$A.class
(C) A.class
(D) Test&A.class
Solution:
A is inner class in Test, Then A is compiled into file named as Test$A.class. In Java these inner classes comes under the concept of anonymous inner class. A is inner class means it is local class to the Test class.
Thus the Correct option is (B) itself.
(3) Which statement is true about a non-static inner class?
(A) It can access private instance variables in the enclosing object.
(B) It can only be instantiated in the enclosing class.
(C) It must implement an interface.
(D) It must be final if it is declared in a method scope.
(E) It is accessible from any other class.
Solution:
The statement “It can access private instance variables in the enclosing object” is True.
(4) Suppose A is an anonymous inner class in Test. A is compiled into a file named ________.
(A) Test&1.class
(B) Test$1.class
(C) A.class
(D) Test$A.class
(E) A$Test.class
Solution:
A is inner class in Test, Then A is compiled into file named as Test$A.class. In Java these inner classes comes under the concept of anonymous inner class. A is inner class means it is local class to the Test class.
Thus the Correct option is (D) itself.
(5) A JavaFX action event handler contains a method ________.
(A) public void actionPerformed(Event e)
(B) public void actionPerformed(ActionEvent e)
(C) public void handle(ActionEvent e)
(D) public void handle(Event e)
Solution:
JavaFx action event handler contains a method public void handle (ActionEvent e).This method is used to handle the event. This method handles the event like when the user key is pressed and other operations.
Thus the Correct option is (C)
(6) A JavaFX event handler for event type T is an instance of ________.
(A) Action
(B)EventHandler<T>
(C)EventHandler
(D)ActionEvent
Solution:
JavaFX event handler for event type T is an instance of EventHandler<T>.This EventHandler handles the instance of T through the EventHandler<T>.
Thus the Correct option is (B)
(7) To register a source for an action event with a handler, use ________.
(A)source.addAction(handler)
(B)source.addOnAction(handler)
(C)source.setActionHandler(handler)
(D) source.setOnAction(handler)
Solution:
To register a source for an action event with handler ,use source.setOnAction(handler).source is an source object and setOnAction(handler) method to register a handler.
Thus the Correct option is (D)
(8) Which of the following statements is true?
(A) A class is registered with the source object for processing the event.
(B) A handler object fires an event.
(C) A Source object fires an event.
(D) Any object such a String object can fire an event.
Solution:
The Statement “A handler object fires an event” is True.
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.