Final Study Guide
TRUE OR FALSE: When in the same try statement you are handling multiple exceptions and some of the exceptions are related to each other through inheritance, you should handle the more general exception classes before the more specialized exception classes.
False
TRUE OR FALSE: You can list only one selector in the first line of a style definition.
False
TRUE OR FALSE: You cannot have more than one catch clause per trystatement.
False
Write code that loads the audio file C:\media\saxaphone.wav, and creates a MediaPlayer object that is ready to play the file.
File soundFile = new File("C:\\media\\saxaphone.wav"); Media media = new Media(soundFile.toURI().toString()); MediaPlayer player = new MediaPlayer(media);
Write code that loads the video file meteor_shower.mp4, and creates a MediaViewer object that is ready to play the file in a viewing window that is 640 by 480 in size.
File videoFile = new File("meteor_shower.mp4"); Media media = new Media(videoFile.toURI().toString()); MediaPlayer player = new MediaPlayer(media); MediaView view = new MediaView(player); view.setFitWidth(640.0); view.setFitHeight(480.0);
Write a statement that creates an object that can be used to write binary data to the file Configuration.dat.
FileOutputStream fstream = new FileOutputStream("Configuration.dat");
What is the base case of each of the recursive methods listed in Algorithm Workbench 3?
For question 3 the base case is reached when arg is equal to 10.
TRUE OR FALSE: The Node class's setEffect method accepts multiple effect objects as arguments, allowing you to combine effects.
False
TRUE OR FALSE: The Stage class is in the javafx.scene package.
False
TRUE OR FALSE: The throws clause causes an exception to be thrown.
False
TRUE OR FALSE: When an exception is thrown by code inside a try block, all of the statements in the try block are always executed.
False
An application has a Button control named calcButton, and you have applied a stylesheet to the root node. In that style sheet, you have defined a custom style class named button-red. Write the statement that would apply the button-red custom style class to the calcButton control.
calcButton.getStyleClass().add("button-red");
This is an internal list of all the methods that are currently executing. a) invocation list b) call stack c) call list d) list trace
call stack
The EventHandler interface specifies a method named . a. register b. onClick c. fire d. handle
handle
This is when method A calls method B, which calls method A. a. implicit recursion b. modal recursion c. direct recursion d. indirect recursion
indirect recursion
This RadioButton method returns true if this control is selected. a. selected() b. clicked() c. isSelected() d. isChecked()
isSeletected()
This type of node cannot have other nodes as children. a. leaf node b. root node c. container node d. branch node
leaf node
Assume myBox is a Rectangle object. Write the statement that rotates myBox 45 degrees about its center.
myBox.setRotate(45.0);
Assume myBox is a Rectangle object. Write the code that scales myBox to half its current size, along both the X and Y axes.
myBox.setScaleX(0.5); myBox.setScaleY(0.5);
This is the part of a problem that is solved with recursion. a. base case b. iterative case c. unknown case d. recursion case
recursion case
You can think of this code as being "protected" because the application will not halt if it throws an exception. a) try block b) catch block c) finally block d) protected block
try block
. These are exceptions that inherit from the Error class or the RuntimeException class. a) unrecoverable exceptions b) unchecked exceptions c) recoverable exceptions d) checked exceptions
unchecked exceptions
Assume the vbox variable references a VBox container. Write a statement that adds 10 pixels of padding around the inside edge of the container.
vbox.setPadding(new Insets(10));
TRUE OR FALSE: In the base case, a recursive method calls itself with a smaller version of the original problem.
False
The CSS property is used to change a control's background color in a JavaFX application. a. -fx-color b. -fx-background-color c. -fx-color-background d. -fx-bg-color
-fx-background-color
What style definition applies a background color of #0000FF to all Buttoncontrols? a. .button { -fx-background-color: #0000FF; } b. .button { -fx-bg-color = #0000FF; } c. .button.all { -fx-background-color: #0000FF; } d. .global {button: -fx-background-color: #0000FF; }
.button { -fx-background-color: #0000FF; }
Write a JavaFX CSS style definition that will be applied to all Label controls. The style definition should specify the following: font size: 24, font style: italic, font weight: bold.
.label { -fx-font-size: 24pt; -fx-font-style: italic; -fx-font-weight: bold;
Which of these is written in the correct syntax for a CSS style definition? a. {.label: -fx-font-size: 20pt; } b. .label { -fx-font-size=20pt; } c. .label { -fx-font-size: 20pt; } d. {.label; -fx-font-size: 20pt; }
.label { -fx-font-size: 20pt; }
If you want to apply styles to all of the nodes in a scene, use the selector. a. .all-nodes b. .stage c. .home d. .root
.root
If you want to apply styles to all of the nodes in a scene, what selector would you use in a style definition?
.root
Write the code that creates a menu bar with one menu named File. The File menu should have the F key assigned as a mnemonic. The File menu should have three menu items: Open, Print, and Exit. Assign mnemonic keys of your choice to each of these items.
// Create the menu bar. MenuBar menuBar = new MenuBar(); // Create the File menu. Menu fileMenu = new Menu("_File"); MenuItem openItem = new MenuItem("_Open"); MenuItem printItem = new MenuItem("_Print"); MenuItem exitItem = new MenuItem("E_xit"); fileMenu.getItems().add(openItem, printItem, exitItem);
When you define a color in CSS, you specify an integer value in the range of for each of the color components (red, green, and blue). a. 0 through 255 b. 0 through 1024 c. −255−255 through 255 d. 0 through 128
0 through 255
In a 640 by 480 window, what are the coordinates of the pixel in the upper-right corner of the window?
639, 0
What is an event-driven program?
A program that responds to the user's actions.
TRUE OR FALSE: Any time the user releases a key, a KEY_PRESSED event occurs.
False
TRUE OR FALSE: By default, ListView controls are oriented horizontally
False
TRUE OR FALSE: By default, TextArea controls perform line wrapping.
False
TRUE OR FALSE: It is not necessary to have a base case in all recursive algorithms.
False
TRUE OR FALSE: Some problems can be solved through recursion only.
False
TRUE OR FALSE: The HBox container makes all of the nodes it contains of the same height.
False
In CSS, what is the difference between a type selector and an ID selector?
A type selector is used to apply a style definition to all nodes of a specific type. An ID selector can be used to apply a style definition to a node with a specific ID.
What is the difference between a text file and a binary file?
All of the data stored in a text file is formatted as text. Even numeric data is converted to text when it stored in a text file. You can view the data stored in a text file by opening it with a text editor, such as Notepad. In a binary file, data is not formatted as text. Subsequently, you cannot view a binary file's contents with a text editor.
What is the difference between an editable ComboBox and an uneditable ComboBox?
An editable ComboBox allows the user to select an item from a dropdown list, or type input into a field that is similar to a TextField. By default, ComboBox controls are uneditable, which means that the user cannot type input into the control; he or she can only select items from a dropdown list.
What is meant when it is said that an exception is thrown?
An exception object has been created in response to an error that has occurred.
What is the difference between an iterative algorithm and a recursive algorithm?
An iterative algorithm uses a loop to solve the problem, while a recursive algorithm uses a method that calls itself
What types of objects can be thrown?
Any object that inherits from the Throwable class.
All JavaFX applications must extend the class. a. JavaFX b. Application c. GUI d. Window
Application
Typically, when the user clicks this type of control, an action takes place. a. Button b. Label c. TextField d. Switch
Button
Write a statement that creates a Button control with the text Click Me displayed on the button.
Button myButton = new Button("Click Me");
When recursion is used to solve a problem, why must the recursive method call itself to solve a smaller version of the original problem?
By reducing the problem with each recursive call, the base case will eventually be reached and the recursion will stop.
You want the user to be able to select any number of items from a group of items. Would you use RadioButton controls or CheckBox controls?
CheckBoxes
Write a statement that instantiates the Circle class, and uses the constructor to draw a circle with its center point at (100, 75) and with a radius of 120.
Circle myCircle = new Circle(100, 75, 120);
The control presents its items in a drop-down list. a. DropList b. ListView c. ComboBox d. ItemList
ComboBox
You want to provide 20 items in a list for the user to select from. Which control would take up less space on the screen, a ListView or a ComboBox?
ComboBox
What happens when an exception is thrown, but the try statement does not have a catch clause that is capable of catching it?
Control of the program is passed to the previous method in the call stack (that is, the method that called the offending method). If that method cannot handle the exception, then control is passed again, up the call stack, to the previous method. This continues until control reaches the main method. If the main method does not handle the exception, then the program is halted and the default exception handler handles the exception.
TRUE OR FALSE: IOException serves as a superclass for exceptions that are related to programming errors, such as an out-of-bounds array subscript.
False
TRUE OR FALSE: If you make any changes to an application's stylesheet, you have to recompile the Java application in order for the style changes to take effect.
False
TRUE OR FALSE: In a 640 by 480 window, the coordinates of the pixel in the lowerright corner are (640, 480).
False
What two effect classes can you use to create shadow effects?
DropShadow and InnerShadow
You use this class to specify the amount of time that an animation should last. a. TimeSpan b. Duration c. Clock d. AnimationTime
Duration
TRUE OR FALSE: A Menu object cannot contain other Menu objects.
False
Write a statement, after the following code, that creates an HBox container, and adds the label1, label2, and label3 controls to it: Label label1 = new Label("One"); Label label2 = new Label("Two"); Label label3 = new Label("Three");
HBox hbox = new HBox(label1, label2, label3);
FileNotFoundException inherits from . a) Error b) IOException c) JavaException d) FileException
IOException
You use this class to load an image file into memory. a. ImageView b. ImageLoader c. Image d. Img
Image
Assume your JavaFX application is in the same directory as an image file named Cat.png. Write the code to create the Image and ImageView objects you will need to display the image.
Image image = new Image("file:Cat.png"); ImageView imageView = new ImageView(image);
Write a statement that creates an Image object, loading the Cat.png file from the - following Internet location: http://www.greendale.edu/images/
Image image = new Image("http://www.greendale.edu/images/Cat.png");
You use this class to actually display an image. a. ImageView b. ImageLoader c. Image d. Img
ImageView
What type of recursive method do you think would be more difficult to debug: one that uses direct recursion or one that uses indirect recursion? Why?
Indirect recursion, because it involves multiple methods being called.
What is the purpose of the Application class's launch method?
It creates a Stage object that will be the application's window, and it calls the start method, passing a reference to the Stage object as an argument.
What is the purpose of the Application class's abstract start method?
It is the entry point for the application
The primary purpose of this type of control is to display text. a. Button b. Label c. Message d. Text
Label
Write a statement that instantiates the Line class, and uses the constructor to draw a line from (50, 25) to (150, 125).
Line myLine = new Line(50, 25, 150, 125);
The control displays a list of items and allows the user to select one or more items from the list. a. DropList b. ListView c. ViewList d. ItemList
ListView
Write code that creates a ListView control named snackListView. Add the following strings to the ListView: "cheese", "olives", "crackers".
ListView<String> snackListView = new ListView<>(); snackListView.getItems().addAll("cheese", "olives", "crackers");
You use these two classes to play an audio file. a. Media and MediaPlayer b. Audio and AudioPlayer c. Sound and SoundPlayer d. LoadMedia and PlayMedia
Media and MediaPlayer
You use this class to create a menu bar. a. MenuItem b. MenuBar c. Menu d. Bar
MenuBar
The numeric wrapper classes' "parse" methods all throw an exception of this type. a) ParseException b) NumberFormatException c) IOException d) BadNumberException
NumberFormatException
Both the ListView control and the ComboBox control keeps its list of items in a(n) object. a. ArrayList b. ExpandableList c. ItemList d. ObservableList
ObervableList
You want the user to be able to select only one item from a group of items. Would you use RadioButton controls or CheckBox controls?
RadioButtons
You use this class to create a radio menu item. a. MenuItem b. RadioButton c. RadioItem d. RadioMenuItem
RadioMenuItem
Write a statement that opens the file Customers.dat as a random access file for both reading and writing.
RandomAccessFile randomFile = new RandomAccessFile("Customers.dat", "rw");
Write a statement that instantiates the Rectangle class, and uses the constructor to draw a rectangle with its upper-left corner at (100, 200), with a width of 175, and a height of 150.
Rectangle myRectangle = new Rectangle(100, 200, 175, 150);
Which repetition approach is less efficient: a loop or a recursive method? Why?
Recursive algorithms are usually less efficient than iterative algorithms. This is because a method call requires several actions to be performed by the JVM, such as allocating memory for parameters and local variables, and storing the address of the program location where control returns after the method terminates.
Assume the hbox variable references an HBox container. Write a statement that creates a Scene object, adds hbox as the root node, and sets the size of the scene to 300 pixels wide by 200 pixels high.
Scene scene = new Scene(hbox, 300, 200);
Line, Circle, and Rectangle are subclasses of the class. a. Sprite b. Geometry c. BasicShape d. Shape
Shape
What selection mode would you select if you want the user to only select a single item in a ListView?
Single selection mode
Write a statement that instantiates the Text class, and uses the constructor to draw the string "Hello World", starting at the coordinates 100, 200.
Text myText = new Text(100.0, 200.0, "Hello World");
A is like a TextField that can accept multiple lines of input. a. TextArea b. MultilineTextField c. ExpandableTextField d. TextEditorField
TextArea
Write code that creates a TextArea displaying 10 rows and 15 columns. The text area should perform line wrapping.
TextArea textArea = new TextArea(); textArea.setPrefColumnCount(10); textArea.setPrefRowCount(15); textInput.setLineWrap(true);
This type of control appears as a rectangular region that can accept keyboard input from the user. a. Button b. Label c. TextField d. InputField
TextField
Find the error: .button { -fx-background-color = #0000FF; }
The = operator should be a colon.
What two classes do you use to display an image?
The Image and ImageView classes
What is an image's aspect ratio? How do you make sure it is preserved when you resize an image?
The aspect ratio is the ratio of the image's width to the image's height. If you change an image's aspect ratio, the image will appear stretched (either horizontally or vertically). The ImageView class has a method named setPreserveRatio that you can call to make sure that an image's aspect ratio is preserved.
What is a recursive algorithm's base case? What is the recursive case?
The base case is a case in which the problem can be solved without recursion. A recursion case uses recursion to solve the problem, and always reduces the problem to a smaller version of the original problem.
try { number = Integer.parseInt(str); } catch (Exception e) { System.out.println(e.getMessage()); } catch (IllegalArgumentException e) { System.out.println("Bad number format."); } catch (NumberFormatException e) { System.out.println(str + " is not a number."); }
The catch (Exception e) statement and its block should appear after the other catch blocks, because this is a more general exception than the others.
// This code has an error! myImageView.setWidth(100); myImageView.setHeight(100);
The correct code is: myImageView.setFitWidth(100); myImageView.setFitHeight(100);
What is the purpose of a finally clause?
The finally statement's block is always executed after the try block has executed and after any catch blocks have executed if an exception was thrown. The statements in the finally block execute whether an exception occurs or not.
Where does execution resume after an exception has been thrown and caught?
The first statement after that try/catch construct.
// This code has an error! RadioButton radio1 = new RadioButton("Option 1"); RadioButton radio2 = new RadioButton("Option 2"); ToggleGroup radioGroup = new ToggleGroup(); radioGroup.setToggleGroup(radio1); radioGroup.setToggleGroup(radio2);
The last two statements should be: radio1.setToggleGroup(radioGroup); radio2.setToggleGroup(radioGroup);
Find the error: / This code has an error! @Override public void start(Scene primaryScene) { primaryScene.show(); }
The parameter for the overridden start method must be a Stage object, not a Scene object.
What does it mean to catch an exception?
The program intercepts the exception and responds to it.
Find the error: .label { -font-size: 14pt; }
The property should be -fx-font-size
public class FindTheError { public static void main(String[] args) { myMethod(0); } public static void myMethod(int num) { System.out.print(num + " "); myMethod(num + 1); } }
The recursive method, myMethod, has no base case. So, it has no way of stopping.
What is the difference between the throw statement and the throws clause?
The throw statement causes an exception to be thrown. The throws clause informs the compiler that a method throws one or more exceptions
How a problem is usually reduced with a recursive method?
The value of an argument is usually reduced.
// This code has an error! ListView<String> myListView = new ListView<>(); myListView.getItems().addAll(10, 20, 30, 40);
This ListView control is declared to hold Strings, so an error will occur when trying to add integers to it.
All exception classes inherit from this class. a) Error b) RuntimeException c) JavaException d) Throwable
Throwable
Adding RadioButton controls to this type of object creates a mutually exclusive relationship between them. a. MutualExclude b. RadioGroup c. LogicalGroup d. ToggleGroup
ToggleGroup
This class creates an animation in which a node moves from one position to another over a period of time. a. TranslateTransition b. MoveTransition c. MotionTransition d. PositionTransition
TranslateTransition
TRUE OR FALSE: A MenuBar object acts as a container for Menu objects.
True
TRUE OR FALSE: A node's setStyle method removes any styles that were previously applied to the node, and replaces them with the new style rule that is passed as an argument.
True
TRUE OR FALSE: A scroll bar automatically appears when a ListViewcontains more items than can be displayed in the space provided.
True
TRUE OR FALSE: An iterative algorithm will usually run faster than an equivalent recursive algorithm.
True
TRUE OR FALSE: If a style definition for a specific type of node contradicts a style rule in the .root definition, the more specific style definition takes precedence over the .root definition.
True
TRUE OR FALSE: If an ellipse's X-radius and Y-radius have the same value, then the ellipse will be a circle.
True
TRUE OR FALSE: In a 640 by 480 window, the coordinates of the pixel in the upperleft corner are (0, 0).
True
TRUE OR FALSE: Not including polymorphic references, a try statement may have only one catch clause for each specific type of exception.
True
TRUE OR FALSE: Only one object at a time may be placed into a BorderPane region.
True
TRUE OR FALSE: When an exception is thrown, the JVM searches the trystatement's catch clauses from top to bottom and passes control of the program to the first catch clause with a parameter that is compatible with the exception
True
TRUE OR FALSE: You are not required to catch exceptions that inherit from the RuntimeException class
True
TRUE OR FALSE: You can nest a layout container inside of another layout container
True
What is the difference between a checked exception and an unchecked exception?
Unchecked exceptions are those that inherit from the Error class or the RuntimeException class. You should not handle these exceptions because the conditions that cause them can rarely be dealt with within the program. All of the remaining exceptions (that is, those that do not inherit from Error or RuntimeException) are checked exceptions. These are the exceptions that you should handle in your program.
This container arranges its contents in a single, vertical row. a. VerticalBox b. VBox c. GridPane d. HBox
VBox
What happens when you serialize an object? What happens when you deserialize an object?
When an object is serialized it is converted to a series of bytes which are written to a file. When the object is deserialized, the series of bytes are converted back into an object.
When are you required to have a throws clause in a method header?
When the code in a method can potentially throw a checked exception and the method doesn't handle the exception, then that method must have a throws clause.
What is the difference between a sequential access file and a random access file?
With sequential access, when a file is opened for input, its read position is at the very beginning of the file. This means that the first time data is read from the file, the data will be read from its beginning. As the reading continues, the file's read position advances sequentially through the file's contents. In random file access, a program may immediately jump to any location in the file without first reading the preceding bytes. The difference between sequential and random file access is like the difference between a cassette tape and a compact disc. When listening to a CD, there is no need to listen to or fast-forward over unwanted songs. You simply jump to the track that you want to listen to.
Describe three different techniques discussed in this chapter for writing event handlers.
Writing the definition of an inner class that implements the EventHandler interface. Then, instantiating that class, and registering it with a control. Instantiating an anonymous inner class that implements the EventHandler interface, and registering the object with a control. Using a lambda expression to instantiate an anonymous inner class that implements the EventHandler interface, and registering the object with a control.
When multiple exceptions are caught in the same try statement and some of them are related through inheritance, does the order in which they are listed matter?
Yes. When in the same try statement you are handling multiple exceptions and some of the exceptions are related to each other through inheritance, then you should handle the more specialized exception classes before the more general exception classes. Otherwise, a catch statement designed to catch a general exception might catch a more specialized exception through polymorphism.
How do you retrieve the text that the user has entered into a TextFieldcontrol?
You call the control's getText method. The method returns the value that has been entered into the TextField as a String.
What is the purpose of a ToggleGroup?
You group RadioButtons together with a ToggleGroup so only one of the RadioButtons can be selected at a time.
Find the error: // This code has an error! ImageView view = new ImageView("file:HotAirBalloon.png");
You must first load the image with the Image class. Then, you pass the Image object as an argument to the ImageView class.
What purpose do layout containers serve?
You use layout containers to arrange the positions of controls on the screen.
This is the part of a problem that can be solved without recursion. a. base case b. solvable case c. known case d. iterative case
base case
Assume borderPane is the name of an existing BorderPane object. Write statements that add the following existing components to the BorderPane: 1. Add label1 to the top region 2. Add label2 to the bottom region 3. Add label3 to the center region 4. Add label4 to the left region 5. Add label5 to the right region
borderPane.setTop(label1); borderPane.setBottom(label2); borderPane.setCenter(label3); borderPane.setLeft(label4); borderPane.setRight(label5);
This type of node can have other nodes as children. a. leaf node b. master node c. anchor node d. branch node
branch node
All exceptions that do not inherit from the Error class or the RuntimeException class are a) unrecoverable exceptions b) unchecked exceptions c) recoverable exceptions d) checked exceptions
checked exceptions
If your code does not handle an exception when it is thrown, it is dealt with by this. a) default exception handler b) the operating system c) system debugger d) default exception generator
default exception handler
This is when a method explicitly calls itself. a. explicit recursion b. modal recursion c. direct recursion d. indirect recursion
direct recursion
This is a section of code that gracefully responds to exceptions. a) exception generator b) exception manipulator c) exception handler d) exception monitor
exception handler
This is one or more statements that are always executed after the try block has executed and after any catch blocks have executed if an exception was thrown. a) try block b) catch block c) finally block d) protected block
finally block
This method can be used to retrieve the error message from an exception object. a) errorMessage b) errorString c) getError d) getMessage
getMessage
In the hexadecimal color value #05AAFF, the AA value specifies which color component? a. red b. green c. blue d. magenta
green
Assume myCircle is a Circle object. Which of these statements causes myCircle to Not be filled with a color? a. myCircle.setColor(null); b. myCircle.setStroke(null); c. myCircle.setFill(null); d. myCircle.setFill(Color.NONE);
myCircle.setFill(null);
An application has a Label control named myLabel. Write a statement that applies an inline style rule to myLabel. The style rule should set the font size to 12 points.
myLabel.setStyle("-fx-font-size: 12pt");
This refers to the actions taken internally by the JVM when a method is called. a. overhead b. set up c. clean up d. synchronization
overhead
This method may be called from any exception object, and it shows the chain of methods that were called when the exception was thrown. a) printInvocationList b) printCallStack c) printStackTrace d) printCallList
printStackTrace
The method getValueFromFile is public and returns an int. It accepts no arguments. The method is capable of throwing an IOException and a FileNotFoundException. Write the header for this method.
public int getValueFromFile() throws IOException, FileNotFoundException
Write an iterative version (using a loop instead of recursion) of the factorial method shown in this chapter.
public static int factorial(int num) { int fac = 1; for (int i = 1; i <=num; i++) { fac = fac * i; } return fac; }
Modify the method you wrote in Algorithm Workbench 1 so it displays the String backwards.
public static void main(String [] args) { String str = "test string"; display(str, str.length()-1); } public static void display(String str, int pos) { if (pos >= 0) { System.out.print(str.charAt(pos)); display(str, pos - 1); } }
Convert the following iterative method to one that uses recursion: public static void sign(int n) { while (n > 0) { System.out.println("No Parking"); n--; }}
public static void sign(int n) { if (n > 0) { System.out.println("No Parking"); sign(n - 1); } }
Write the code to add the following RadioButton controls to the ToggleGroup. RadioButton radio1 = new RadioButton("Option 1"); RadioButton radio2 = new RadioButton("Option 2"); RadioButton radio3 = new RadioButton("Option 3"); ToggleGroup radioGroup = new ToggleGroup();
radio1.setToggleGroup(radioGroup); radio2.setToggleGroup(radioGroup); radio3.setToggleGroup(radioGroup);
Write functional RGB notation for a color where red=100,green=20,red=100,green=20, and blue=255.blue=255.
rgb(100, 20, 255);
There can be only one of these in a scene. It is the parent of all the other nodes. a. leaf node b. master node c. root node d. branch node
root node
In memory, the GUI objects in a scene are organized as nodes in this type of structure. a. scene array b. scene graph c. scene tree d. scene stack
scene graph
Suppose we have a stylesheet named styles.css, and in our Java code the scenevariable references the Scene object. Write a statement to add the stylesheet to the scene.
scene.getStylesheets().add("mystyles.css");
Assume scene is the name of a Scene object, and styles.css is the name of a CSS stylesheet. Write the statement that applies the styles.css stylesheet to scene.
scene.getStylesheets().add("styles.css");
This is the process of converting an object to a series of bytes that represent the object's data. a) serialization b) deserialization c) dynamic conversion d) casting
serialization
What RotateTransition class method do you use to specify a node's starting and ending angles?
setFromAngle setToAngle setToX and setToY
What TranslateTransition class methods do you use to specify a node's starting location?
setFromX and setFromY
Which Node class method do you call to rotate a node about its center? a. rotate() b. rotateCenter() c. setRotate() d. centerRotate()
setRotate()
When a selector name starts with a period in a JavaFX CSS style definition, it means the selector corresponds to . a. specific variable names in the application b. specific types of JavaFX nodes c. values that the user enters d. named constants in the application
specific types of JavaFX nodes
Find the error: 1. catch (FileNotFoundException e) { System.out.println("File not found."); } try { File file = new File("MyFile.txt"); Scanner inputFile = new Scanner(file); }
the try block must appear first before the catch block
. You use this statement to throw an exception manually. a) try b) generate c) throw d) System.exit(0)
throw
Write a statement that throws an IllegalArgumentException with the error message "Argument cannot be negative".
throw new IllegalArgumentException("Argument cannot " + "be negative.");
Write a statement that throws an instance of the exception class that you created in Algorithm Workbench 5.
throw new NegativeNumber(); Or throw new NegativeNumber(number);
When an exception is generated, it is said to have been . a) built b) thrown c) caught d) killed
thrown
This informs the compiler of the exceptions that could get thrown from a method. a) throws clause b) parameter list c) catch clause d) method return type
throws clause
The BorderPane layout container has five regions known as which of the following? a. north, south, east, west, center b. top, bottom, left, right, center c. up, down, left, right, middle d. I, II, III, IV, and V
top, bottom, left, right, center