Test01 Flashcards

1
Q

On a Web page, the ________ specifies what information to display and the ________ specifies how that information should be displayed.

  1. HTML, CSS
  2. CSS, HTML
  3. HTML, JavaFX
  4. code,CSS
A

HTML, CSS

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

In the hexadecimal color value #CCAA99, the CC refers to which color component?

  1. yellow
  2. blue
  3. green
  4. red
A
  1. Red (redred,greengreen,blueblue)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

In order to preserve an image’s aspect ratio (so it does not appear stretched or distorted), you should use which of the following? Assume myView references an ImageView object.

  1. myView.setPreserveRatio();
  2. myView.setPreserveRatio(true);
  3. myView.setPreserveRatio(false)
  4. Either A or C would work
A
  1. myView.setPreserveRatio(true);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

In order to leave 15 pixels of space in an HBox container, use which of the following statements?

  1. myhbox.setPadding(new Insets(15));
  2. myhbox.setPadding.Insets(15);
  3. myhbox.setPadding(15);
  4. myhbox = setPadding(15);
A
  1. myhbox.setPadding(new Insets(15));
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

In memory, GUI objects in a ________ are organized as ________ in a tree-like hierarchical data structure.

  1. scene graph, nodes
  2. scene, nodes
  3. scene graph, methods
  4. node, scenes
A
  1. scene, nodes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

In a JavaFX application, you must recompile the application each time you make a change to the stylesheet.

True
False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

In a JavaFX application, you are limited to a single layout container since layout containers cannot be nested.

True
False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In a JavaFX application, a CSS type selector corresponds to a specific JavaFX node.

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

If you set a scene’s size to a width and height that is smaller than the width and height of the image to be displayed,

  1. the scene will automatically be resized to fit the image
  2. only part of the image will be displayed
  3. the image will automatically be resized to fit the window
  4. the image will only occupy part of the window
A
  1. Only part of the image will be displayed
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

If you have two RadioButtons ( dogRadio and catRadio), how should you code them to create a mutually exclusive relationship?

  1. dogRadio.setToggleGroup();
    catRadio.setToggleGroup();
  2. ToggleGroup radioGroup = new ToggleGroup();
    dogRadio.setToggleGroup(radioGroup);
    catRadio.setToggleGroup(radioGroup);
  3. ToggleGroup dogRadio = new ToggleGroup();
    ToggleGroup catRadio = new ToggleGroup();
  4. ToggleGroup radioGroup = new radioGroup();
    dogRadio.setToggle(radioGroup);
    catRadio.setToggle(radioGroup);
A
  1. ToggleGroup radioGroup = new ToggleGroup();
    dogRadio.setToggleGroup(radioGroup);
    catRadio.setToggleGroup(radioGroup);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

***If a BorderPane region does not contain anything,

  1. the region will appear gray by default
  2. an error will occur
  3. the content from an adjacent region will be duplicated in the empty region
  4. the region will not appear in the GUI
A
  1. the region will not appear in the GUI
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How would a stylesheet named javafxstyles.css be applied to a JavaFX application, assuming that scene is the variable that refers to a Scene object?

  1. scene.getStylesheets().add(javafxstyles.css);
  2. scene.getStylesheets().add(“javafxstyles.css”);
  3. scene.addStylesheets().get(“javafxstyles.css”);
  4. scene.getStyles().add(“javafxstyles”);
A
  1. scene.getStylesheets().add(“javafxstyles.css”);
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Given the following styles, what size will the text of myLabel be?
.root { -fx- font-size: 12pt; }
.label { -fx- font-size: 18pt; }

  1. 18 pts
  2. 15 pts
  3. 12 pts
  4. This will cause an error because there are duplicate font-size styles.
A

18pts

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

CSS uses the RGB color system to define colors and colors can be specified using six hexadecimal numbers preceded by the # symbol.

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

A TextArea is a multiline TextField that can accept or display several lines of text.

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

A ComboBox differs only from a ListView in that a ComboBox must have a minimum of three items.

True
False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
17
Q

Assuming three ImageView objects named puppy, kitten, and bunny have been created, what does the following statement do?
HBox hbox = new HBox(5, puppy, kitten, bunny);

  1. The statement does nothing; it contains an error.
  2. There will be five pixels of space between the controls horizontally in the container.
  3. The controls will be displayed vertically with five pixels between them.
  4. The number 5 referes to the number of ImageView objects so there will be two empty spots for more ImageView objects.
A
  1. There wil be five pixels of space between the controls horizontally in the container.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
18
Q

Adding RadioButton controls to a ________ object creates a mutually exclusive relationship between them.

  1. MutualGroup
  2. ToggleGroup
  3. ExcludeGroup
  4. RadioGroup
A
  1. ToggleGroup
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
19
Q

***One important difference between the command line interface and a GUI interface is that

  1. in a GUI environment the user determines the order in which things happen while the user has no control over the order or events in a command line interface.
  2. users must type information in a command line interface but, when using a GUI, typing is never required.
  3. in command line the background color of hte monitor will always be black but in a GUI it can be any color.
  4. All of these are important differences.
A
  1. in a GUI environment the user determines the order in which things happen while the user has no control over the order or events in a command line interface.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
20
Q

Padding is space that appears around the inside edges of a container.

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
21
Q

Radio buttons are normally used when you want the user to be able to select one or more options from a group of several possible options.

True
False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

Select all that apply. Given the statement shown below, which of the following statements are true?
Scene scene = new Scene(hbox, 100, 500);

  1. A Scene object named scene will be created
  2. The height of the scene will be 100 pixels
  3. the root node is hbox
  4. The width of the scene will be 100 pixels
A

One1. A Scene object named scene will be created
Three3. The root node is hbox
Four4. The width of the scene will be 100 pixels

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
23
Q

Select all that apply. The SetStyle method is used to apply style rules directly to a JavaFX node. This method

  1. is considered a better way to add styles than using a stylesheet
  2. allows you to pass only one style rule at a time, such as a string argument
  3. removes any styles that were previously applied to that node.
  4. allows you to pass multiple style rules as string arguments.
A
  1. removes any styles that were previously applied to that node.
  2. allows you to pass multiple style rules as string arguments.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
24
Q

Select all that apply. Which of the following are constructors of the BorderPane class?

  1. BorderPane(top, bottom)
  2. BorderPane(center, top, right, bottom, left)
  3. BorderPane(center)
  4. BorderPane()
  5. BorderPane(left, right)
A
  1. BorderPane(center, top, right, bottom, left)
  2. BorderPane(center)
  3. BorderPane()
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
Q

Select all that apply. Which of the following are operations that can be performed by the launch method?

  1. creating a Stage object
  2. calling the start method
  3. calling the Application constructor
  4. calling an event handler
A
  1. creating a Stage object
  2. calling the start method
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
26
Q

The ________ layout container arranges the contents into cells, similar to a spreadsheet.

  1. GRID
  2. CellPane
  3. GridPaneObj
  4. GridPane
A
  1. GridPane
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
27
Q

The command line interface is an event-driven interface.

True
False

A

False

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
28
Q

The process of connecting an event handler object to a control is called ________ the event handler.

  1. registering
  2. rendering
  3. passing
  4. applying
A
  1. registering
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
29
Q

Select all that apply. Which of the following are possible selection nodes available to the ListView control?

  1. single selection node
  2. multiple selection mode
  3. single interval selection mode
  4. multiple interval selection node
A

One1. single selection node

Four4. multiple interval selection node

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
30
Q

Select all that apply. Which of the following are regions where content can be displayed in the BorderPane layout container?

  1. above and below center
  2. top and bottom
  3. center
  4. left and right
A
  1. top and bottom
  2. center
  3. left and right
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
31
Q

The ________ class is used to create a menu bar.

  1. MenuItem
  2. Menu
  3. MenuBar
  4. Bar
A
  1. MenuBar
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
32
Q

An event object is created when an event takes place.

True
False

A

True

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
33
Q

An event handler class will not be executed unless it has been registered with the correct control.

True
False

A

True

34
Q

An action that takes place while a program is running is a(n)

  1. event handler.
  2. event.
  3. event object.
  4. event source.
A
  1. event
35
Q

All JavaFX applications must extend the Application class.

True
False

A

True

36
Q

The ________ control uses a drop-down list as its display.

  1. ItemList
  2. TextList
  3. ListView
  4. DropList
A
  1. ListView
37
Q

The control that displays a list of items and allows the user to select an item from the list is the ________ control.

  1. List
  2. SelectionList
  3. ListView
  4. ArrayList
A
  1. ListView
38
Q

The foundation of a GUI application is the

  1. Stage object
  2. Scene object
  3. Application class
  4. start method
A
  1. Application class
39
Q

The type of control normally used when you want the user to only be allowed to select one option from several possible options is the

  1. CheckBox.
  2. RadioButton.
  3. Button.
  4. Any of these
A
  1. RadioButton.
40
Q

The BorderPane container always displays its content in five regions which are top, bottom, left, right, and center and each region must be used.

True
False

A

False

41
Q

The Application class’s ________ method is the main entry point for a JavaFX application.

  1. addWindow
  2. init
  3. start
  4. mainFX
A
  1. start
42
Q

Select all that apply. Which of the following file types are supported by the Image class?

  1. PNG
  2. BMP
  3. JPEG
  4. GIF
A
  1. PNG
  2. BMP
  3. JPEG
  4. GIF
43
Q

Select all that apply. Which of the following methods can be used with both ArrayLists and ObservableLists?

  1. the size method
  2. the remove method
  3. the set method
  4. the get method
A
  1. the size method
  2. the remove method
  3. the set method
  4. the get method
44
Q

Select all that apply. Which of the following nodes are allowed in a scene graph?

  1. Root
  2. Leaf
  3. Button
  4. Branch
A
  1. Root
  2. Leaf
  3. Branch
45
Q

Multiple Choice Select all that apply. Which of the following ComboBox methods require a boolean argument?

  1. setEditable
  2. getValue
  3. setValue
  4. setVisibleRowCount
A
  1. setEditable
46
Q

Styles specified with the .root selector take precedence over styles applied to any other node.

True
False

A

False

47
Q

The “preferred size” of a scene is usually the whole size of the user’s monitor.

True
False

A

False

48
Q

When an event takes place, the control responsible for the event creates an event ____

  1. object
  2. handler
  3. firing
  4. source
A
  1. object.
49
Q

To display an image in a JavaFX application, you use either the Image or ImageView class.

True
False

A

False

50
Q

Which of the following statements creates an empty TextArea?

  1. TextArea textArea = new TextArea.textArea(“”);
  2. TextArea textArea = new TextArea(“ “);
  3. TextArea textArea = new TextArea();
  4. TextArea = new textArea();
A
  1. TextArea textarea = new TextArea();
51
Q

To apply specific styles to all of the nodes in a scene, use the ________ selector.

  1. .root
  2. .all
  3. .stage
  4. .top
A
  1. .root
52
Q

To build a menu system you must

  1. create the Menu objects and register an event handler for each menu item object
  2. Add the MenuBar object to the scene graph.
  3. create a MenuBar
  4. All of these are necessary steps
A
  1. create the Menu objects and register an event handler for each menu item object
  2. Add the MenuBar object to the scene graph.
  3. create a MenuBar
    ***4. All of these are necessary steps
53
Q

To change the alignment of an HBox you call the

  1. Pos method
  2. Alignment method
  3. PreferredSize method
  4. setAlignment method
A
  1. setAlignment method.
54
Q

To create a mutually exclusive relationship between RadioMenuItem controls, you must group them in a ToggleGroup object.

True
False

A

True

55
Q

Select all that apply. Which of the following classes inherit from the Region class?

  1. Label
  2. RadioButton
  3. ListBox
  4. CheckBox
A
  1. Label
  2. RadioButton
    Four4. CheckBox
56
Q

Which of the following is not a way a user can interact with a computer?

  1. Console interface
  2. GUI
  3. Command line
  4. All of these are ways a user can interact with a computer.
A
  1. Console interface
  2. GUI
  3. Command line
    ***4. All of these are ways a user can interact with a computer.
57
Q

Which of the following statements correctly adds a label to the first row and second column of a GridPane object?

  1. gridpane.add(myLabel, 0, 1);
  2. gridpane.add(myLabel, 1, 2);
  3. gridpane.add(myLabel, 2, 1);
  4. gridpane.add(myLabel, 1, 0);
A
  1. gridpane.add(myLabel, 0, 1);
58
Q

To create a TextField control, you use the ________ class which is in the ________ package.

  1. TextField, javafx.texfield
  2. TextField, javafx.text.control
  3. TextField, javafx.scene.control
  4. TextBox, javafx.scene.control
A
  1. TextField, javafx.scene.control
59
Q

To display an image in a JavaFX application you must

  1. include either the setImage or the ViewImage class
  2. include both the setImage and the ViewImage classes
  3. include both the Image and the ImageView classes
  4. include either the Image or the ImageView class
A
  1. include both the Image and ImageView classes
60
Q

To retrieve text that a user has typed into a TextField control, you call the ________ method.

  1. getInputText
  2. inputText

3.getInput

4.getText

A
  1. getText
61
Q

Which CSS type selector corresponds with the TextField JavaFX class?

  1. text-field
  2. text-box
  3. text-area
  4. text
A
  1. text-field
62
Q

Which of the following creates a custom style class that will allow a Button control to appear with a blue background and yellow text?

1.
.button-color {
-fx- bgcolor: blue;
-fx- textfill: yellow;
}

2.
.button-color {
-fx- background-color: blue;
-fx- text-fill: yellow;
}

3.
.blue-button {
background-color:blue;
text-fill:yellow;
}

4.
.blue-button {
-fx- background: blue;
-fx- text: yellow;
}

A

2.
.button-color {
-fx- background-color: blue;
-fx- text-fill: yellow;
}

63
Q

Which of the following is a CSS named color?

  1. crimson
  2. maroon
  3. lavender
  4. All of these
A
  1. crimson
  2. maroon
  3. lavender
    ***4. All of these
64
Q

Which of the following statements creates a Slider with a range of 1 to 20 with a starting value of 1?

  1. Slider slider = new Slider(1.0, 20.0, 1.0);
  2. Slider slider = new Slider (0, 20, 1);
  3. Slider slider = new slider(0.0, 20.0, 1.0);
  4. Slider slider = new Slider(1.0, 20);
A
  1. Slider slider = new Slider(1.0, 20.0, 1.0);
    ^min, max, start^
65
Q

Which of the following statements will allow a user to type input into a field of a ComboBox named myComboBox?

  1. ComboBox.setEditable;
  2. myComboBox.setEditable(true);
  3. ComboBox.setEditable(myComboxBox);
  4. myComboBox = ComboBox.setEditable(true);
A
  1. myComboBox.setEditable(true);
66
Q

Which of the following statements will set a ListView control, puppyListView, to be 300 pixels high and 200 pixels wide?

  1. puppyListView.setSize(200, 300);
  2. puppyListView.setPrefSize(300, 200);
  3. puppyListView.setSize(300, 200);
  4. puppyListView.setPrefSize(200, 300);
A
  1. puppyListView.setPrefSize(200, 300);
67
Q

In a JavaFX CSS style definition, if a selector name starts with a period, that selector corresponds to a

  1. named color
  2. value entered by the user
  3. specific variable in the application
  4. specific JavaFX node
A
  1. specific JavaFX node.
68
Q

In JavaFX all CSS properties begin with -fx-.

True
False

A

True

69
Q

In CSS, selector names that begin with a period are called ________ selectors.

  1. type
  2. node
  3. object
  4. class
A
  1. type
70
Q

Which of the following will create a CheckBox that displays pizza and shows up as selected?

  1. CheckBox checkOne(“pizza”) = setSelected(true);
  2. CheckBox checkOne = new CheckBox(“pizza”);
    checkOne.setSelected(true);
  3. CheckBox checkOne.setSelected(true) = “pizza”;
  4. CheckBox checkOne = new CHeckBox(“pizza”);
    checkBox.setSelected(false);
A
  1. CheckBox checkOne = new CheckBox(“pizza”);
    checkOne.setSelected(true);
71
Q

What does the following statement do?
Image puppy = new Image(“file:C:\images\terrier.jpg”)

  1. It loads an image file named terrier.jpg which is found in the images folder on the user’s C-drive.
  2. It creates an instance of the ImageView class with the terrier.jpg file passed to the constructor.
  3. It loads an image named “images\terrier.jpg” and stores the image in the Image variable.
  4. Nothing; it is not possible to include a path to a file when using the Image class.
A
  1. It loads an image file named terrier.jpg which is found in the images folder on the user’s C-drive.
72
Q

What happens when the following code is executed?
ComboBox<string> my ComboBox = new
ComboBox<>();
myComboBox.getItems().addAll(5, 10, 15, 20);</string>

  1. A compiler error will occur.
  2. The values 5, 10, 15, and 20 will be added to a ComboBox named myComboBox.
  3. The values 5, 10, 15, and 20 will be converted to strings and added a new ComboBox named myComboBox.
  4. A ComboBox displaying the numbers 5, 10, 15, and 20 will be created.
A
  1. A compiler error will occur.
73
Q

Which of the following import statements is required in order to create a BorderPane layout container?

  1. import javafx.scene.layout;
  2. import javafx.scene.layout.BorderPane;
  3. import javafx.layout.scene.BorderPane;
  4. import javafx.scene.layout.Box;
A
  1. import javafx.scene.layout.BorderPane;
74
Q

Which of the following import statements is required in order to write an event handler class?

  1. import javafx.EventHandler.event;
  2. import javafx.EventHandler;
  3. import javafx.event.ActionEvent;
  4. import javafx.event.EventHandler;
A
  1. import javafx.event.EventHandler;
75
Q

Which package contains the Insets class?

  1. javafx.layout
  2. javafx.scene
  3. javafx.Insets
  4. javafx.geometry
A
  1. javafx.geometry
76
Q

What method do you call to register an event handler with a Button control?

  1. setOnClick
  2. setAction
  3. setOnAction
  4. onClickAction
A
  1. setOnAction
77
Q

When programming in JavaFX, you should think of the GUI objects as nodes in a tree-like hierarchical structure known as a scene graph.

True
False

A

True

78
Q

When the user selects an item in a ListView, a change event occurs.

True
False

A

True

79
Q

What does the following code do, assuming there is a variable that references a Scene object?
myScene.getStylesheets().add(“sceneStyles.css”);

  1. The getStylesheets method gets sceneStyles.css and adds it to the myScene object.
  2. It adds a stylesheet named myScene to Scene
  3. It adds a stylesheet named sceneStyles to Scene
  4. The getStylessheets method returns an object containing the scene’s collection of stylesheets and that object’s add method adds sceneStyles.css to the collection.
A
  1. The getStylessheets method returns an object containing the scene’s collection of stylesheets and that object’s add method adds sceneStyles.css to the collection.
80
Q

To replace a ListView control’s existing items with a new list of items, use the ________ method.

  1. getItems.setAll()
  2. getItems.addAll()
  3. getItems().addAll()
  4. getItems().setAll()
A
  1. getItems().setAll()