Programming 2 Final - Chapters 11, 12, 14
12.5.3 Q2: The space between a node's contents and its top, right, bottom and left edges is known as the ________, which separates the contents from the node's edges. a. margin b. spacing. c. padding. d. None of the above.
c. padding.
The throws clause of a method: a. specifies the exceptions a method catches. b. specifies the exceptions thrown by the calling method. c. specifies the exceptions a method throws. d. specifies the exceptions a method throws and catches.
c. specifies the exceptions a method throws.
14.3.7 Q2: Which of the following is not a method of class String? a. toUpperCase b. trim c. toCharacterArray d. All of the above are methods of class String
c. toCharacterArray
To catch an exception, the code that might throw the exception must be enclosed in a: a. throws block. b. catch block. c. try block. d. finally block.
c. try block.
12.4.5 Q1: Layout containers help you arrange GUI components. A VBox arranges its nodes________. a. left to right b. by best fit c. vertically from top to bottom d. None of the above.
c. vertically from top to bottom
12.5.5 Q3: Which of the following statements is false? a. As of Java SE 8, an anonymous inner class can access its top-level class's instance variables, static variables and methods, but has limited access to the local variables of the method in which it's declared—it can access only the final local variables declared in the enclosing method's body. b. The @FXML annotation preceding an instance variable indicates that the variable's name can be used in the FXML file that describes the app's GUI. c. An anonymous inner class is a class that's declared without a name and typically appears inside a method declaration. d. Since an anonymous inner class has no name, one object of the class must be created at the point where the class is declared.
a. As of Java SE 8, an anonymous inner class can access its top-level class's instance variables, static variables and methods, but has limited access to the local variables of the method in which it's declared—it can access only the final local variables declared in the enclosing method's body.
Which of the following errors is synchronous? a. Divide by zero. b. Arithmetic overflow. c. Unsuccessful memory allocation. d. All of the above.
a. Divide by zero.
12.5.2 Q2: Which of the following statements is false? a. Each cell in a GridPane can be empty or can hold one or more JavaFX components, including layout containers that arrange other controls. b. Each component in a GridPane can span multiple columns or rows. c. A TextField (package javafx.scene.control) can accept text input or display text. d. A Slider (package javafx.scene.control) represents a value in the range 0.0-1.0 by default and allows the user to select a number in that range by moving the Slider's thumb.
a. Each cell in a GridPane can be empty or can hold one or more JavaFX components, including layout containers that arrange other controls.
Which of the following statements regarding the throw point of an exception is false? a. It specifies the point at which the exception must be handled. b. It is the initial point at which the exception occurs. c. It is specified as the top row of the method-call stack at the time the exception occurred. d. All of the above statements are true.
a. It specifies the point at which the exception must be handled.
12.5.4 Q3: Stage method show displays the ________. a. Stage window b. scene graph c. root node d. title bar
a. Stage window
14.6 Q1: Consider the Java segment: String line1 = new String("c = 1 + 2 + 3") ; StringTokenizer tok = new StringTokenizer(line1, delimArg); For the String line1 to have 4 tokens, delimArg should be: a. String delimArg = "+="; b. String delimArg = "123" c. String delimArg = "c+"; d. String delimArg = " ";
a. String delimArg = "+=";
14.3.7 Q1: Consider the String below: String r = "a toyota"; Which of the following will create the String r1 = "a TOYOTa"? a. String r1 = r.replace("toyot", TOYOT"); b. String r1 = r.replace('t','T'); r1 = r.replace('o','0'); r1 = r.replace('y','Y'); c. String r1 = r.replace('t','T').replace('o', '0').replace('y', 'Y'); d. String r1 = r.substring(2, 4).toUpperCase();
a. String r1 = r.replace("toyot", TOYOT");
Which of the following statements is true? a. The throw statement is used to throw an exception. b. The throw statement is used to specify that a method will throw an exception. c. The throw statement is used to access an exception parameter. d. All of the above.
a. The throw statement is used to throw an exception.
Which of the following statements about try blocks is true? a. The try block must be followed by at least one catch block. b. The try block must be followed by a finally block. c. The try block should contain statements that may process an exception. d. The try block should contain statements that may throw an exception.
a. The try block must be followed by at least one catch block.
After a finally block has finished executing (and there are no exceptions to be handled): a. control proceeds to the first statement after the finally block. b. control returns to the throw point. c. the application exits. d. control proceeds to the first statement after the last catch block.
a. control proceeds to the first statement after the finally block.
14.3.4 Q2: For String c = "Hello. She sells sea shells"; The Java statements int i = c.indexOf("ll"); int j = c.lastIndexOf("ll"); will result in: a. i = 2 and j = 24. b. i = 3 and j = 24. c. i = 2 and j = 25. d. i = 3 and j = 23.
a. i = 2 and j = 24.
14.3.3 Q1: The statement s1.equalsIgnoreCase(s4) is equivalent to which of the following? a. s1.regionMatches(true, 0, s4, 0, s4.length()); b. s1.regionMatches(0, s4, 0, s4.length()); c. s1.regionMatches(0, s4, 0, s4.length); d. s1.regionMatches(true, s4, 0, s4.length);
a. s1.regionMatches(true, 0, s4, 0, s4.length());
14.3.2 Q1: The length of a string can be determined by ________. a. the String method length() b. the String instance variable length c. the String method strlen() d. All of the above.
a. the String method length()
14.7: Q3: Which of the Java strings represent the regular expression ,\s*? a. "\,\s\*" b. ",\\s*" c. ",\\s\\*" d. ".\\s\*"
b. ",\\s*"
14.6 Q2: Consider the Java segment: String line1 = new String("c = 1 + 2 + 3") ; StringTokenizer tok = new StringTokenizer(line1); int count = tok.countTokens(); The value of count is ________. a. 8. b. 7. c. 13. d. 4.
b. 7.
12.5.2 Q1: A JavaFX app's main class directly inherits from ________. a. Main b. Application c. App d. Object
b. Application
Which of the following statements is false? a. Exception handling enables programmers to write robust and fault-tolerant programs. b. Exception handling can catch but not resolve exceptions. c. Exception handling can resolve exceptions. d. All of the above are true.
b. Exception handling can catch but not resolve exceptions.
12.5.2 Q3: Which of the following statements is false? a. When the user interacts with a GUI component, the interaction—known as an event—drives the program to perform a task. b. For events that occur when the value of a control's property changes, you must create the event handler entirely using only drag and drop in Scene Builder. c. The code that performs a task in response to an event is called an event handler. d. For certain events you can link a control to its event handling method by using the Code section of Scene Builder's Inspector window. In this case, the class that implements the event-listener interface will be created for you and will call the method you specify.
b. For events that occur when the value of a control's property changes, you must create the event handler entirely using only drag and drop in Scene Builder.
Which of the following exceptions is a checked exception? a. ArithmeticException. b. IOException. c. RuntimeException. d. InputMismatchException.
b. IOException.
14.5 Q2: Which class is not a type-wrapper class? a. Character b. Int c. Double d. Byte
b. Int
14.3.6 Q1: Consider the statements below: String a = "JAVA: "; String b = "How to "; String c = "Program"; Which of the statements below will create the String r1 = "JAVA: How to Program"? a. String r1 = c.concat(b.concat(a)); b. String r1 = a.concat(b.concat(c)); c. String r1 = b.concat(c.concat(a)); d. String r1 = c.concat(c.concat(b));
b. String r1 = a.concat(b.concat(c));
12.5.2 Q4: Which of the following statements is false? a. JavaFX applications in which the GUI is implemented as FXML adhere to the Model-View-Controller (MVC) design pattern, which separates an app's data (contained in the model) from the app's GUI (the view) and the app's processing logic (the controller). b. The model presents the data stored in the view. c. When a user provides input, the controller modifies the model with the given input. d. When the model changes, the controller updates the view to present the changed data.
b. The model presents the data stored in the view.
In the catch block below, what is arithmeticException? catch ( ArithmeticException arithmeticException ) { System.err.printf( arithmeticException ); } // end catch a. The type of the exception being caught. b. The name of catch block's exception parameter. c. A finally block. d. An exception handler.
b. The name of catch block's exception parameter.
12.4.7 Q1: Which of the following statements is false? a. You can set a Label's text either by double clicking it and typing the text, or by selecting the Label and setting its Text property in the Inspector's Properties section. b. When adding controls to a VBox, each new control is placed adjacent to the preceding ones by default. c. To set the image to display, select the ImageView then set its Image property in the Inspector's Properties section. An image's aspect ratio is the ratio of the image's width to its height. d. To specify an ImageView's size, set its Fit Width and Fit Height properties in the Inspector's Layout section.
b. When adding controls to a VBox, each new control is placed adjacent to the preceding ones by default.
14.3.5 Q2: The String method substring returns ________. a. a char b. a String c. void d. a char[]
b. a String
14.4.5 Q1: Consider the statements below: StringBuilder sb = new StringBuilder("a toyota"); sb.insert(2, "landrover"); sb.delete(11, 16); sb.insert(11, " "); The StringBuilder contents at the end of this segment will be ________. a. a landrovertoyota b. a landrover a c. a landrov a d. a landrover toy a
b. a landrover a
In Java, after an exception is handled, control resumes_______________. This is known as the ____________ model of exception handling. a. after the last catch block (or the finally block, if there is one), termination b. after the last catch block (or the finally block, if there is one), resumption c. just after the throw point, termination d. just after the throw point, resumption
b. after the last catch block (or the finally block, if there is one), resumption
14.4.1 Q1: Given the following declarations: StringBuilder buf; StringBuilder buf2 = new StringBuilder(); String c = new String("test"); Which of the following is not a valid StringBuilder constructor? a. buf = new StringBuilder(); b. buf = new StringBuilder(buf2, 32); c. buf = new StringBuilder(32); d. buf = new StringBuilder(c);
b. buf = new StringBuilder(buf2, 32);
14.4.2 Q2: Given the following declarations: StringBuilder buffer = new StringBuilder("Testing Testing"); buffer.setLength(7); buffer.ensureCapacity(5); Which of the following is true? a. buffer has capacity 5. b. buffer has capacity 31. c. buffer has content "Testin". d. buffer has length 15.
b. buffer has capacity 31.
14.4.3 Q1: Consider the statement below: StringBuilder sb1 = new StringBuilder("a toyota"); Which of the following creates a String object with the value "toy"? a. String res = sb1.subString(2, 5); b. char dest[] = new char[sb1.length()]; sb1.getChars(2, 5, dest, 0); String res = new String(dest); c. char dest[] = new char[sb1.length]; dest = sb1.getChars(2, 5); String res = new String(dest); d. char dest[] = new char[sb1.length()]; dest = sb1.getChars(0, 3); String res = new String(dest);
b. char dest[] = new char[sb1.length()]; sb1.getChars(2, 5, dest, 0); String res = new String(dest);
14.3.8 Q1: Which of the following will create a String different from the other three? a. String r = "123456" b. int i = 123; int j = 456; String r = String.valueOf(j) + String.valueOf(i); c. int i = 123; int j = 456; String r = String.valueOf(i) + String.valueOf(j); d. int i = 123; int j = 456; String r = i + j;
b. int i = 123; int j = 456; String r = String.valueOf(j) + String.valueOf(i);
14.2 Q2: An anonymous String ________. a. has no value b. is a string literal c. can be changed d. none of the above
b. is a string literal
12.3 Q1: The window in which a JavaFX app's GUI is displayed is known as the________. a. main window b. stage c. podium d. rostrum
b. stage
If the catch-or-declare requirement for a checked exception is not satisfied: a. the compiler will issue an error message indicating that the exception must be caught. b. the compiler will issue an error message indicating that the exception must be caught or declared. c. a stack trace will be displayed indicating the exception that has occurred and where it occurred. d. a stack trace will be displayed, along with a message indicating that the exception must be caught.
b. the compiler will issue an error message indicating that the exception must be caught or declared.
When an exception occurs it is said to have been: a. caught. b. thrown. c. declared. d. handled.
b. thrown.
14.4.1 Q2: Given the following declaration: StringBuilder buf = new StringBuilder(); What is the capacity of buf? a. 0 b. 10 c. 16 d. 20
c. 16
14.7 Q2: Which of the following statements is true? a. Ranges of characters can be represented by placing a ~ between two characters. b. [^Z] is the same as [A~Y]. c. Both "A*" and "A+" will match "AAA", but only "A*" will match an empty string. d. All of above.
c. Both "A*" and "A+" will match "AAA", but only "A*" will match an empty string.
Which of the following is true? a. A precondition must be true when a method is invoked. b. A postcondition must be true when a method successfully returns to its caller. c. Both of the above. d. Neither of the above.
c. Both of the above.
Which of the following statements is true? a. Using existing exceptions makes the program less robust. b. Always create your own exception classes. c. Like any other class, an exception class can contain fields and methods. d. The new exception class should extend RuntimeException if the program should be required to handle the exception.
c. Like any other class, an exception class can contain fields and methods.
12.5.4 Q1: Which of the following statements is false? a. To display a GUI, you must attach it to a Scene, then attach the Scene to the Stage that's passed into Application method start. b. By default, the Scene's size is determined by the size of the scene graph. c. Overloaded versions of the Scene constructor allow you to specify the Scene's size and fill (a color, gradient or image). d. Scene method setTitle specifies the text that appears in the Stage window's title bar.
c. Overloaded versions of the Scene constructor allow you to specify the Scene's size and fill (a color, gradient or image).
12.4.2 Q1: The NetBeans ________ window provides access to all of your projects. Within a project's node, the contents are organized into folders and files. a. FXML b. GUI c. Projects d. Root
c. Projects
14.4.4 Q1: Which of the following creates the string of the numbers from 1 to 1000 most efficiently? a. String s; for (int i = 1; i <= 1000; i++) s += i; b. StringBuilder sb = new StringBuilder(10); for (int i = 1; i <= 1000; i++) sb.append(i); String s = new String(sb); c. StringBuilder sb = new StringBuilder(3000); for (int i = 1; i <= 1000; i++) sb.append(i); String s = new String(sb); d. All are equivalently efficient.
c. StringBuilder sb = new StringBuilder(3000); for (int i = 1; i <= 1000; i++) sb.append(i); String s = new String(sb);
12.2 Q1: Which of the following statements is false? a. JavaFX Scene Builder is a standalone JavaFX GUI visual layout tool that can also be used with various IDEs. b. JavaFX Scene Builder enables you to create GUIs by dragging and dropping GUI components from Scene Builder's library onto a design area, then modifying and styling the GUI—all without writing any code. c. The FXML code is integrated with the program logic that's defined in Java source code—this integration of the interface (the GUI) with the implementation (the Java code) makes it easier to debug, modify and maintain JavaFX GUI apps. d. JavaFX Scene Builder generates FXML (FX Markup Language)—an XML vocabulary for defining and arranging JavaFX GUI controls without writing any Java code.
c. The FXML code is integrated with the program logic that's defined in Java source code—this integration of the interface (the GUI) with the implementation (the Java code) makes it easier to debug, modify and maintain JavaFX GUI apps.
Which of the following statements is false? a. A finally block is placed after the last catch block. b. A finally block typically releases resources acquired in the corresponding try block. c. The finally block and try block can appear in any order. d. A finally block is optional.
c. The finally block and try block can appear in any order.
12.3 Q2: Which of the following statements is false? a. A JavaFX GUI is defined as a scene graph—a tree structure of an app's visual elements, such as GUI controls, shapes, images, video, text and more. b. Each visual element in the scene graph is a node—an instance of a subclass of Node (package javafx.scene), which defines common attributes and behaviors for all nodes in the scene graph. c. The first node in the scene graph is known as the origin. d. Nodes that have children are typically layout containers that arrange their child nodes in the scene.
c. The first node in the scene graph is known as the origin.
14.4.2 Q1: Which of the following statements is true? a. The capacity of a StringBuilder is equal to its length. b. The capacity of a StringBuilder cannot exceed its length. c. The length of a StringBuilder cannot exceed its capacity. d. Both a and b are true.
c. The length of a StringBuilder cannot exceed its capacity.
12.5.3 Q3: Which of the following statements is false? a. You can specify the default amount of space between a GridPane's columns and rows with its Hgap (horizontal gap) and Vgap (vertical gap) properties, respectively. b. You can type in a TextField only if it's "in focus"—that is, it's the control that the user is interacting with. c. When you click an interactive control, it prompts for input. d. When you press the Tab key, the focus transfers from the current focusable control to the next one—this occurs in the order the controls were added to the GUI.
c. When you click an interactive control, it prompts for input.
11.13 Q1: Which of the following statements about the try-with-resources statement is false? a. The try-with-resources statement simplifies writing code in which you obtain a resource, use it in a try block and release the resource in a corresponding finally block.. b. You allocate the resource in the parentheses following the try keyword and use the resource in the try block; then the statement implicitly calls the resource's close method at the end of the try block. c. You allocate the resource in the parentheses following the try keyword and use the resource in the try block; then you explicitly call the resource's close method at the end of the try block. d. Each resource must be an object of a class that implements the AutoCloseable interface—such a class has a close method.
c. You allocate the resource in the parentheses following the try keyword and use the resource in the try block; then you explicitly call the resource's close method at the end of the try block.
14.7: Q1: Which of the following is not a word character? a. w b. 0 c. _ d. &
c. _
12.5.5 Q1: Class NumberFormat of package java.text provides numeric formatting capabilities, such as locale-specific currency and percentage formats. a. percentage formats b. locale-specific currency c. a) and b) d. Neither a) nor b).
c. a) and b)
Chained exceptions are useful for finding out about: a. exceptions thrown using the chained keyword. b. checked exceptions only. c. an original exception that was caught before the current exception was thrown. d. the current exception's chain of superclasses.
c. an original exception that was caught before the current exception was thrown.
14.3.1 Q1: A String constructor cannot be passed ________. a. char arrays. b. int arrays. c. byte arrays. d. Strings.
c. byte arrays.
14.3.1 Q2: String objects are immutable. This means they ________. a. must be initialized b. cannot be deleted c. cannot be changed d. None of the above
c. cannot be changed
11.12 Q1: Java SE 7's multi-catch enables you to catch multiple exception types in a single catch handler and perform the same task for each type of exception. The syntax for a multi-catch is: a. catch ( Type1 or Type2 or Type3 e ) b. catch ( Type1 e1 | Type2 e2 | Type3 e3 ) c. catch ( Type1 | Type2 | Type3 e ) d. catch ( Type1 e1 or Type2 e2 or Type3 e )
c. catch ( Type1 | Type2 | Type3 e )
14.4.3 Q2: To find the character at a certain index position within a String, use the method ________. a. getChars, with the index as an argument b. getCharAt, with the index as an argument c. charAt, with the index as an argument d. charAt, with the character you are searching for as an argument
c. charAt, with the index as an argument
All exception classes inherit, either directly or indirectly, from: a. class Error. b. class RuntimeException. c. class Throwable. d. None of the above.
c. class Throwable.
12.5.2 Q5: In a JavaFX FXML app, you define the app's event handlers in a________class, which defines instance variables for interacting with controls programmatically, as well as event-handling methods. a. view b. model c. controller d. data
c. controller
14.3.5 Q1: For String c = "Now is the time for all"; The Java statements String i = c.substring(7); String j = c.substring(4, 15); will result in: a. i = "he time for all" and j = "is the time" b. i = "the time for all" and j = "s the time" c. i = "the time for all" and j = "is the time " d. i = "he time for all" and j = "s the time"
c. i = "the time for all" and j = "is the time "
14.3.4 Q1: For String c = "hello world"; The Java statements int i = c.indexOf('o'); int j = c.lastIndexOf('l'); will result in: a. i = 4 and j = 8. b. i = 5 and j = 8. c. i = 4 and j = 9. d. i = 5 and j = 9.
c. i = 4 and j = 9.
An uncaught exception: a. is a possible exception that never actually occurs during the execution of the program. b. is an exception that occurs for which the matching catch clause is empty. c. is an exception that occurs for which there are no matching catch clauses. d. is another term for a thrown exception.
c. is an exception that occurs for which there are no matching catch clauses.
14.3.2 Q2: How many String objects are instantiated by the following code segment (not including the literals)? String s1, output; s1 = "hello"; output = "\nThe string reversed is: " ; for (int i = s1.length() - 1; i >= 0; i--) output += s1.charAt(i) + " " ; a. 1. b. 4. c. 5. d. 7.
d. 7.
12.5.5 Q2: A JavaFX Button's event handler receives a(n) ________, which indicates that the Button was clicked. a. ButtonEvent b. ObjectEvent c. ControlEvent d. ActionEvent
d. ActionEvent
14.3.3 Q2: The statement s1.startsWith("art") has the same result as which of the following? a. s1.regionMatches(0, "art", 0, 3); b. s2 = s1.getChars(0, 3); s2.equals("art"); c. s1.regionMatches(true, 0, "art", 0, 3); d. All of the above
d. All of the above
12.5.3 Q1: Which of the following statements is false? a. You can set a Button's text by double clicking it, or by selecting the Button, then setting its Text property in the Inspector window's Properties section. b. A GridPane column's contents are left-aligned by default. c. Setting a node's Pref Width property of a GridPane column to USE_COMPUTED_SIZE indicates that the width should be based on the widest child. d. All of the above are true.
d. All of the above are true.
12.3 Q3: Which of the following statements is false? a. The nodes arranged in a layout container are a combination of controls and possibly other layout containers. b. When the user interacts with a control, it generates an event. Programs can use event handling to specify what should happen when each user interaction occurs. c. An event handler is a method that responds to a user interaction. An FXML GUI's event handlers are defined in a controller class. d. All of the above statements are true.
d. All of the above statements are true.
14.4 Q1: StringBuilder objects can be used in place of String objects if ________. a. the string data is not constant b. the string data size may grow c. the programs frequently perform string concatenation d. All of the above.
d. All of the above.
14.5 Q1: Which of the following are static Character methods? a. Character.hashcode(char c); b. Character.isDigit(char c); c. Character.equals(char c); d. All of the above.
d. All of the above.
14.7: Q4: Which of the following statements is true? a. Class Matcher provides methods find, lookingAt, replaceFirst and replaceAll. b. Method matches (from class String, Pattern or Matcher) will return true only if the entire search object matches the regular expression. c. Methods find and lookingAt (from class Matcher) will return true if a portion of the search object matches the regular expression. d. All of the above.
d. All of the above.
Exceptions can be thrown by: a. the Java Virtual Machine. b. code in a try block. c. calls from a try block to other methods. d. All of the above.
d. All of the above.
When an unchecked exception occurs in a method but is not caught: a. the method-call stack is "unwound." b. the method terminates. c. all local variables in that method go out of scope. d. All of the above.
d. All of the above.
14.2 Q1: Consider the examples below: A. a string. B. 'a string'. C. "a string". D. "1234". E. integer. Which could be the value of a Java variable of type String? a. A and B. b. B and E. c. B and C. d. C and D.
d. C and D.
Which of the following is not included in an exception's stack trace? a. A descriptive message for the exception. b. The method-call stack at the time the exception occurred. c. The name of the exception. d. Instructions on handling the exception.
d. Instructions on handling the exception.
12.1 Q1: Which of the following statements is false? a. A graphical user interface (GUI) presents a user-friendly mechanism for interacting with an app. A GUI (pronounced "GOO-ee") gives an app a distinctive "look-and-feel." b. GUIs are built from GUI components—sometimes called controls or widgets. c. Providing different apps with consistent, intuitive user-interface components gives users a sense of familiarity with a new app, so that they can learn it more quickly and use it more productively. d. Java's GUI, graphics and multimedia API of the future is Swing.
d. Java's GUI, graphics and multimedia API of the future is Swing.
Which of the following statements is true? a. The code in a finally block is executed only if an exception occurs. b. The code in a finally block is executed only if an exception does not occur. c. The code in a finally block is executed only if there are no catch blocks. d. None of the above are true.
d. None of the above are true.
Which of the following statements is false? a. All exceptions must derive from the class Throwable. b. The class Throwable provides the method getStackTrace that outputs the stack trace to the standard error stream. c. The class Throwable provides the method getMessage that returns the descriptive string stored in an exception. d. The string returned from class Throwable's getMessage method contains the name of the exception's class.
d. The string returned from class Throwable's getMessage method contains the name
What is the difference between a try block and a try statement? a. There is no difference; the terms can be used interchangeably. b. A try statement refers to the block of code following the keyword try, while the try block refers to the try keyword and the block of code following this keyword. c. The try block refers to the keyword try followed by a block of code. The try block and its corresponding catch and/or finally clauses together form a try statement. d. The try statement refers to the keyword try followed by a block of code. The try statement and its corresponding catch and/or finally clauses together form a try block.
d. The try statement refers to the keyword try followed by a block of code. The try statement and its corresponding catch and/or finally clauses together form a try block.
12.5.4 Q2: Stage method setScene places________. a. the root node b. text in the Stage window's title bar c. the gradient on the Stage d. a Scene onto a Stage
d. a Scene onto a Stage
12.4.6 Q1: A VBox's ________ determines the layout positioning of its children. a. margin b. padding c. calibration d. alignment
d. alignment
12.4.2 Q2: NetBeans creates three files for a JavaFX FXML Application project—an FXML markup file for the GUI, a file containing the app's main class and a file containing the app's ________ class. a. view b. model c. main d. controller
d. controller
12.4.1 Q1: To create an app in NetBeans, you must first create a project, i.e., a group of related ________, such as code and images that make up an app. a. apps b. applications c. controls d. files
d. files
14.6 Q3: Consider the Java segment: String line1 = new String("c = 1 + 2 + 3") ; StringTokenizer tok = new StringTokenizer(line1, "+="); String foo = tok.nextToken(); String bar = tok.nextToken(); The values of foo and bar are: a. foo is "c ", bar is " = ". b. foo is "c", bar is " ". c. foo is " = ", bar is " + ". d. foo is "c ", bar is " 1 ".
d. foo is "c ", bar is " 1 ".
Which of the following are types of assertions? a. Preconditions. b. Postconditions. c. Conditions in control statements. d. (a), (b) and (c). e. (a) and (b).
e. (a) and (b).