Introduction to Java Programming, Includes Data Structures, Eleventh Edition, Y. Daniel Liang

This quiz is for students to practice. A large number of additional quiz is available for instructors using Quiz Generator from the Instructor's Resource Website. Videos for Java, Python, and C++ can be found at https://yongdanielliang.github.io/revelvideos.html.

Chapter 31 Advanced JavaFX


Section 31.2 JavaFX CSS
31.1  A JavaFX style property is defined with a prefix _______.
A. -fx-
B. fx-
C. -fx
D. fx

31.2  _______ defines a style class.
A. .plaincircle {-fx-fill: white; -fx-stroke: black;}
B. #plaincircle {-fx-fill: white; -fx-stroke: black;}
C. plaincircle {-fx-fill: white; -fx-stroke: black;}
D. +plaincircle {-fx-fill: white; -fx-stroke: black;}

31.3  _______ defines a style id.
A. .plaincircle {-fx-fill: white; -fx-stroke: black;}
B. #plaincircle {-fx-fill: white; -fx-stroke: black;}
C. plaincircle {-fx-fill: white; -fx-stroke: black;}
D. +plaincircle {-fx-fill: white; -fx-stroke: black;}

31.4  Which of the following statements are true?
A. Multiple style sheets can be loaded to a Scene or a Parent.
B. Multiple style classes can be applied to a single node.
C. A style id can be applied to a unique node.
D. A style class and a style id can both be applied to a node.
E. If the same property is defined in both a style class and a style id and applied to a node, the one defined in the style id takes precedence.

31.5  The _________ method loads a style sheet named style.css for a node or a scene.
A. node.setStyleSheet("style.css");
B. node.getStyleSheets.setStyleSheet("style.css");
C. node.getStylesheets.add("style.css");
D. node.setStylesheets("style.css");

31.6  The _________ method sets a style class is named plaincircle for a node or a scene.
A. node.setStyleClass("plaincircle");
B. node.getStyleSheets.setStyleClass("plaincircle");
C. node.getStylesheets.addClass("plaincircle");
D. node.setStyle("plaincircle");

31.7  The _________ method sets a style id named greencircle for a node or a scene.
A. node.setStyleId("greencircle");
B. node.setId("greencircle");
C. node.getStylesheets.addId("greencircle");
D. node.setStyle("greencircle");

31.8  The getStylesheets() method is defined in _________.
A. Scene
B. Node
C. Parent
D. Pane
E. Control

Section 31.3 QuadCurve, CubicCurve, and Path
31.9  The QuadCurve class contains the ___________ properties.
A. startX, startY
B. endX, endY
C. controlX, controlY
D. x, y

31.10  To construct a QuadCurve with starting point (100, 75.5), control point (40, 55.5), and end point (56, 80), use _______.
A. new QuadCurve(100, 75.5, 40, 55.5, 56, 80)
B. new QuadCurve(100, 75.5, 56, 80, 40, 55.5)
C. new QuadCurve(40, 55.5, 100, 75.5, 56, 80)
D. QuadCurve.build().startX(100).startY(75.5).controlX(40).controlY(55.5).endX(56).endY(80).create()

31.11  The CubicCurve class contains the ___________ properties.
A. startX, startY
B. endX, endY
C. controlX1, controlY1
D. controlX2, controlY2
E. x, y

31.12  The __________ method moves the Path position to (100, 100).
A. path.moveTo(100, 100)
B. path.getElements().add(new MoveTo(100, 100))
C. path.add(new MoveTo(100, 100))
D. path.getElements().move(100, 100)

31.13  You can draw a segment in the path using ___________.
A. path.addElements().add(new MoveTo(100, 100));
B. path.addElements().add(new HLineTo(100));
C. path.addElements().add(new VLineTo(100));
D. path.addElements().add(new LineTo(100, 300));

Section 31.4 Coordinate Transformations
31.14  The translateX, translateY, translateZ, rotate, scaleX, scaleY, scaleZ properties are defined in _________.
A. Scene
B. Parent
C. Stage
D. Node

31.15  Assume Rectangle rectangle = new Rectangle(10, 10, 50, 60), what is rectangle.getX() after rectangle.setTranslateX(10)?
A. 10
B. 0
C. 20
D. -10

31.16  Assume Rectangle rectangle = new Rectangle(10, 10, 50, 60), what is rectangle.getX() after rectangle.setRotate(10)?
A. 10
B. 0
C. 20
D. -10

31.17  Assume Rectangle rectangle = new Rectangle(10, 10, 50, 60), what is rectangle.getWidth() after rectangle.setScaleX(2)?
A. 100
B. 50
C. 200
D. 10

Section 31.5 Strokes
31.18  The stroke property is defined in _________.
A. Scene
B. Parent
C. Stage
D. Node
E. Shape

31.19  The _________ property is defined in Shape.
A. stroke
B. strokeWidth
C. strokeType
D. strokeLineCap
E. strokeLineJoin

31.20  _________ is a valid stroke type.
A. StrokeType.INSIDE
B. StrokeType.CENTER
C. StrokeType.OUTSIDE
D. StrokeType.LEFT
E. StrokeType.RIGHT

31.21  _________ is a valid stroke cap type.
A. StrokeLineCap.BUTT
B. StrokeLineCap.ROUND
C. StrokeLineCap.SQUARE
D. StrokeLineCap.ELLIPSE
E. StrokeLineCap.CIRCLE

31.22  _________ is a valid stroke line join.
A. StrokeLineJOIN.MITER
B. StrokeLineJOIN.BEVEL
C. StrokeLineJOIN.ROUND
D. StrokeLineJOIN.SQUARE
E. StrokeLineJOIN.CENTER

31.23  strokeDashArray is an instance of _________.
A. List<Double>
B. List<double>
C. ObservableList<Double>
D. ObservableList<double>

Section 31.6 Menus
31.24  To create a menu bar, use ________.
A. new MenuBar()
B. new Menu()
C. new MenuItem()
D. new CheckMenuItem()
E. new RadioMenuItem()

31.25  To create a menu, use ________.
A. new MenuBar()
B. new Menu()
C. new MenuItem()
D. new CheckMenuItem()
E. new RadioMenuItem()

31.26  To create a menu item, use ________.
A. new MenuBar()
B. new Menu()
C. new MenuItem()
D. new CheckMenuItem()
E. new RadioMenuItem()

31.27  To create a check menu item, use ________.
A. new MenuBar()
B. new Menu()
C. new MenuItem()
D. new CheckMenuItem()
E. new RadioMenuItem()

31.28  To create a radio menu item, use ________.
A. new MenuBar()
B. new Menu()
C. new MenuItem()
D. new CheckMenuItem()
E. new RadioMenuItem()

31.29  You can set a graphic such as an ImageView in a ________.
A. MenuBar
B. Menu
C. MenuItem
D. CheckMenuItem
E. RadioMenuItem

31.30  To add a menu to a menu bar, use _______.
A. menuBar.add(menu)
B. menuBar.addAll(menu)
C. menuBar.getMenus().add(menu)
D. menuBar.getItems().add(menu)

31.31  To add a menu item to a menu, use _______.
A. menu.add(menuItem)
B. menu.addAll(menuItem)
C. menu.getItems().add(menuItem)
D. menu.getMenus().add(menuItem)

Section 31.7 Context Menus
31.32  To add a menu item to a context menu, use _______.
A. contextMenu.add(menuItem)
B. contextMenu.addAll(menuItem)
C. contextMenu.getItems().add(menuItem)
D. contextMenu.getMenus().add(menuItem)

31.33  To display a context menu, use _______.
A. contextMenu.show()
B. contextMenu.show(node)
C. contextMenu.show(node, x, y)
D. contextMenu.show(x, y)

Section 31.8 SplitPane
31.34  To add a node to a split pane, use ________.
A. splitPane.add(node)
B. splitPane.getChildren().add(node)
C. splitPane.getItems().add(node)
D. splitPane.getChildren().addItem(node)

Section 31.9 TabPane
31.35  The possible value of a tab side is ______.
A. Side.TOP
B. Side.BOTTOM
C. Side.LEFT
D. Side.RIGHT

31.36  The ___________ properties are defined in the Tab class.
A. id
B. text
C. tooltip
D. graphic
E. content

31.37  To add a node to a tab, use ___________.
A. tab.getItems().add(node)
B. tab.getChildren().add(node)
C. tab.setContent(node)
D. tab.add(node)

31.38  To add tabs to a tab pane, use ___________.
A. tabPane.getItems().addAll(tab1, tab2)
B. tabPane.getTabs().addAll(tab1, tab2)
C. tabPane.getChildren().addAll(tab1, tab2)
D. tab.addAll(tab1, tab2)

Section 31.10 TableView
31.39  The __________ properties are defined in the TableView class.
A. editable
B. items
C. placeholder
D. selectionModel

31.40  The __________ properties are defined in the TableColumn class.
A. editable
B. graphic
C. id
D. resizable
E. text

31.41  To add a table column to a table view, use __________.
A. tableView.add(tableColumn)
B. tableView.getItems().add(tableColumn)
C. tableView.getChildren().add(tableColumn)
D. tableView.getColumns().add(tableColumn)