Title | Self Quiz Unit 6 (CS1102) |
---|---|
Course | Programming 1 |
Institution | University of the People |
Pages | 13 |
File Size | 133.2 KB |
File Type | |
Total Downloads | 55 |
Total Views | 140 |
I hope this helps for you. Good luck to you all....
● Self-Quiz Unit 6Question 1
Correct
Mark 1.00 out of 1.00
Flag question
Question text Which one of the following is an event handler?
Select one:
a.
an event generator
b.
an event listener
c.
an event loop
d.
an event method
e.
javafx.scene.input.MouseEvent; Feedback Your answer is correct. See Section 6.3.1. The correct answer is: an event listener Question 2
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text Consider the following Java program. What is the superclass of "TestFX"? import javafx.application.Application; import javafx.scene.Scene;
import javafx.stage.Stage; import javafx.application.Platform; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.control.Button; public class TestFX extends Application { public void start(Stage stage) { Button quitButton = new Button("Quit"); quitButton.setOnAction(e -> Platform.exit()); HBox buttonBar = new HBox(quitButton); BorderPane root = new BorderPane(); root.setBottom(buttonBar); Scene scene = new Scene(root, 100, 50); stage.setScene(scene); stage.show(); }
public static void main(String[] args) { launch(args); } }
Select one:
a.
ActionEvent
b.
ActionListener
c.
launch
d.
start
e.
Application Feedback Your answer is incorrect. See Section 5.5.2. The correct answer is: Application Question 3
Correct
Mark 1.00 out of 1.00
Flag question
Question text Consider the following Java program. Which one of the following is a package?
import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.application.Platform;
import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.control.Button; public class TestFX extends Application { public void start(Stage stage) { Button quitButton = new Button("Quit"); quitButton.setOnAction(e -> Platform.exit()); HBox buttonBar = new HBox(quitButton); BorderPane root = new BorderPane(); root.setBottom(buttonBar); Scene scene = new Scene(root, 100, 50); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args);
} }
Select one:
a.
javafx.scene.Scene
b.
start
c.
Stage
d.
Button
e.
BorderPane Feedback
Your answer is correct. See Section 4.6.2. The correct answer is: javafx.scene.Scene Question 4
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text Consider the following Java program. Which statement displays a window with a button on the screen? import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.application.Platform; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.control.Button;
public class TestFX extends Application { public void start(Stage stage) { Button quitButton = new Button("Quit"); quitButton.setOnAction(e -> Platform.exit()); HBox buttonBar = new HBox(quitButton); BorderPane root = new BorderPane(); root.setBottom(buttonBar); Scene scene = new Scene(root, 100, 50); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }
Select one:
a.
HBox buttonBar = new HBox(quitButton);
b.
BorderPane root = new BorderPane();
c.
Scene scene = new Scene(root, 100, 50);
d.
stage.setScene(scene);
e.
stage.show(); Feedback Your answer is incorrect. See Section 6.1.1. The correct answer is: stage.show(); Question 5
Incorrect
Mark 0.00 out of 1.00
Flag question
Question text Consider the following Java program. Which statement registers an object to receive events? import javafx.application.Application; import javafx.scene.Scene; import javafx.stage.Stage; import javafx.application.Platform; import javafx.scene.layout.BorderPane; import javafx.scene.layout.HBox; import javafx.scene.control.Button; public class TestFX extends Application { public void start(Stage stage) { Button quitButton = new Button("Quit"); quitButton.setOnAction(e -> Platform.exit());
HBox buttonBar = new HBox(quitButton); BorderPane root = new BorderPane(); root.setBottom(buttonBar); Scene scene = new Scene(root, 100, 50); stage.setScene(scene); stage.show(); } public static void main(String[] args) { launch(args); } }
Select one:
a.
import javafx.scene.control.Button;
b.
Button quitButton = new Button("Quit");
c.
quitButton.setOnAction(e -> Platform.exit());
d.
root.setBottom(buttonBar);
e.
stage.setScene(scene); Feedback Your answer is incorrect. See Section 6.3.1. The correct answer is: quitButton.setOnAction(e -> Platform.exit()); Finish review...