2.99 See Answer

Question: Describe the difference between pretest loops and


Describe the difference between pretest loops and posttest loops.


> What package are the Label, Button, and TextField classes in?

> What is the purpose of the Application class’s abstract start method?

> Which layout container divides a container into regions known as top, bottom, left, center, and right?

> Assume that a class inherits from the JFrame class. Write code that can appear in the class constructor, which gives the content pane a FlowLayout manager. Components added to the content pane should be aligned with the left edge of each row.

> What is an event-driven program?

> What is the difference between a checked exception and an unchecked exception?

> What types of objects can be thrown?

> Where does execution resume after an exception has been thrown and caught?

> What happens when an exception is thrown, but the try statement does not have a catch clause that is capable of catching it?

> What happens when you serialize an object? What happens when you deserialize an object?

> What is the difference between a text file and a binary file?

> What is meant when it is said that an exception is thrown?

> When does dynamic binding take place?

> What is the difference between overriding a superclass method and overloading a superclass method?

> The variable myWindow references a JFrame object. Write a statement that displays the object’s window on the screen.

> Can a subclass ever directly access the private members of its superclass?

> What is the superclass and what is the subclass in the following line? public class Pet extends Dog

> What is a lambda expression?

> When you instantiate an anonymous inner class, the class must do one of two things. What are they?

> What is an abstract class?

> What is an “is-a†relationship?

> Each of the numeric wrapper classes has a static toString method. What do these methods do?

> Why should you use StringBuilder objects instead of String objects in a program that makes lots of changes to strings?

> Look at the following declaration: enum Color { RED, ORANGE, GREEN, BLUE} 1. What is the name of the data type declared by this statement? 2. What are the enum constants for this type? 3. Write a statement that defines a variable of this type and initial

> Is it advisable or not advisable to write a method that returns a reference to an object that is a private field? What is the exception to this?

> The variable myWindow references a JFrame object. Write a statement that sets the size of the object to 500 pixels wide and 250 pixels high.

> A “has a†relationship can exist between classes. What does this mean?

> Describe the difference in the way variables and class objects are passed as arguments to a method.

> Under what circumstances does an object become a candidate for garbage collection?

> Describe one thing you cannot do with a static method.

> The following statement creates a BankAccount array: BankAccount[ ] acc = new BankAccount[10]; Is it okay or not okay to execute the following statements? acc[0].setBalance(5000.0); acc[0].withdraw(100.0);

> Assuming that array1 and array2 are both array reference variables, why is it not possible to assign the contents of the array referenced by array2 to the array referenced by array1 with the following statement? array1 = array2;

> Look at the following array definition: int[] values = { 4, 7, 6, 8, 2 }; What does each of the following code segments display? System.out.println(values[4]); x = values[2] + values[3]; System.out.println(x); x = ++values[1]; System.out.println(x);

> What is the difference between a size declarator and a subscript?

> Under what circumstances does Java automatically provide a default constructor for a class?

> Assume a program named MailList.java is stored in the DataBase folder on your hard drive. The program creates objects of the Customer and Account classes. Describe the steps that the compiler goes through in locating and compiling the Customer and Accoun

> Write an iterative version (using a loop instead of recursion) of the factorial method shown in this chapter.

> If a class has a private field, what has access to the field?

> What is an accessor method? What is a mutator method?

> When the same name is used for two or more methods in the same class, how does Java tell them apart?

> What is the difference between a class and an instance of a class?

> Explain what is meant by the phrase “pass by value.â€.

> What is the difference between an argument and a parameter variable?

> What is the “divide and conquer†approach to problem solving?

> Why is it critical that accumulator variables are properly initialized?

> Which loop should you use in situations where you want the loop to repeat until the boolean expression is false, but the loop should execute at least once?

> Describe the difference between the while loop and the do-while loop.

> What will the following program display? public class ReviewQuestion5 { public static void main(String[] args) { int x = 10; System.out.println(myMethod(x)); } public static int myMethod(int num) { if (num

> Using the following chart, write an if-else-if statement that assigns .10, .15, or .20 to commission, depending on the value in sales.

> What is a potential error that can occur when a file is opened for reading?

> When writing data to a file, what is the difference between the print and the println methods?

> Why should a program close a file when it’s finished using it?

> Describe a programming problem requiring the use of nested loops.

> What is the advantage of using a sentinel?

> Describe a programming problem that would require the use of an accumulator.

> Briefly describe the difference between the prefix and postfix modes used by the increment and decrement operators.

> How do you open a file so that new data will be written to the end of the file’s existing data?

> Why are the relational operators called “relational�

> What will the following program display? public class Checkpoint { public static void main(String[] args) { int num = 0; showMe(num); } public static void showMe(int arg) { if (arg < 10) showMe(arg + 1); else System.out.println(arg); } }

> Briefly describe how the && operator works.

> Explain the purpose of a flag variable. Of what data type should a flag variable be?

> Assuming you are using the JDK, what command would you type at the operating system command prompt to compile the program LabAssignment.java?

> Why is it good advice to indent all the statements inside a set of braces?

> Will the Java compiler translate a source file that contains syntax errors?

> Explain what is meant by the phrase “conditionally executed.â€.

> What part of an object forms an interface through which outside code may access the object’s data?

> Assume the file SalesAverage.java is a Java source file that contains documentation comments. Assuming you are in the same folder or directory as the source code file, what command would you enter at the operating system command prompt to generate the HT

> Is encapsulation a characteristic of procedural or object-oriented programming?

> Briefly describe what programming style means. Why should your programming style be consistent?

> Write a method that accepts a String as an argument. The method should use recursion to display each individual character in the String.

> What is the difference between machine language code and byte code?

> Briefly describe the difference between variable assignment and variable initialization.

> What is a compiler?

> Why are variable names like x not recommended?

> What is the difference between a syntax error and a logical error?

> The following is program expressed as English statements. What would it display on the screen if it was actual program? The variable x starts with the value 0. The variable y starts with the value 5. Add 1 to x. Add 1 to y. Add x and y, and store the re

> What will the following code segments print on the screen? int a, x = 23; a = x % 2; System.out.println(x + "\n" + a);

> What will the following code segments print on the screen? System.out.print("I am the incredible”) ; System.out.print("computing\nmachine”) ; System.out.print("\nand I will\namaze\n)” ; System.out.println("you.");

> What will the following code segments print on the screen? int freeze = 32, boil = 212; freeze = 0; boil = 100; System.out.println(freeze + "\n"+ boil + "\n");

> 1. The if statement is an example of a ___. 1. sequence structure 2. decision structure 3. pathway structure 4. class structure 2. This type of expression has a value of either true or false. 1. binary expression 2. decision expression 3. unconditional

> Write code that creates a Circle, with a radius of 30, and then creates a TranslateTransition object to animate it. The duration of the animation is 5 seconds. When the animation is played, the Circle object will start at (0, 100), and it will move to th

> 11. Which Scanner class method would you use to read a string as input? 1. nextString 2. nextLine 3. readString 4. getLine 12. Which Scanner class method would you use to read a double as input? 1. nextDouble 2. getDouble 3. readDouble 4. None of these;

> 1. Every complete statement ends with___. 1. period 2. parenthesis 3. semicolon 4. ending brace 2. The following data: 72 ‘A’ “Hello World” 2.8712 Are example of ___. 1. variables 2. literals 3. strings 4. none of these 3. A group of statements, such a

> 11. This is a named storage location in the computer’s memory. 1. class 2. key words 3. variable 4. operator 12. The Java compiler generates ___. 1. machine code 2. byte code 3. source code 4. HTML 13. JVM stands for _____. 1. Java Variable Machine 2

> 1. This part of the computer fetches instructions, carries out the operations commanded by the instructions, and produces some outcome or resultant information. 1. memory 2. CPU 3. Secondary Storage 4. Input device 2. A byte is made up of eight 1. CPUs

> 21. True or False: The controller class usually loads the FXML file and builds the scene graph. 22. True or False: You can use Scene Builder to register a controller class to a GUI. 23. True or False: Registering a controller class to a GUI automatical

> 11. A(n) is a name that identifies a component in the FXML file. 1. fx:name 2. fx:id 3. fx:component 4. fx:variable 12. In a JavaFX application, the class loads the FXML file and builds the scene graph. 1. main application 2. controller 3. event listene

> 1. A(n) is a method that automatically executes when a specific event occurs. 1. controller 2. event listener 3. initialize method 4. autoresponder 2. A is a tree-like hierarchical data structure that contains the components of a JavaFX GUI. 1. director

> 31. True or False: An object of the Frame class does not have a content pane. 32. True or False: In an overriding paint method, you should never call the superclass’s version of the paint method. 33. True or False: Once a Timer object has been starte

> 20. A Timer object generates this type of event. 1. action events 2. timer events 3. item events 4. interval events 21. The following Applet class method returns a URL object with the location of the HTML file that invoked the applet. 1. getHTMLlocation

> 11. In a class that extends JApplet or JFrame you override this method to get a reference to the Graphics object. 1. paint 2. paintComponent 3. getGraphics 4. graphics 12. In a class that extends JPanel you override this method to get a reference to the

> Assume myBox is a Rectangle object. Write the statement that rotates myBox 45 degrees about its center.

> 1. This section of an HTML document contains all of the tags and text that produce output in the browser window. 1. head 2. content 3. body 4. output 2. You place the tag in this section of an HTML document. 1. head 2. content 3. body 4. output 3. Eve

> 30. True or False: A JMenu object cannot contain other JMenu objects. 31. True or False: A JTextArea component does not automatically display scroll bars. 32. True or False: By default, a JTextArea component does not perform line wrapping. 33. True or

> 21. This method sets the intervals at which major tick marks are displayed on a JSlider component. 1. setMajorTickSpacing 2. setMajorTickIntervals 3. setTickSpacing 4. setIntervals 22. True or False: You can use code to change the contents of a read-onl

> 11. This is text that appears in a small box when the user holds the mouse cursor over a component. 1. mnemonic 2. instant message 3. tool tip 4. pop-up mnemonic 12. This is a key that activates a component just as if the user clicked it with the mouse.

> 21. True/False: In SQL, the not-equal-to operator is !=, which is the same as in Java. 22. True/False: When a ResultSet object is initially created, its cursor is pointing at the first row in the result set. 23. True/False: In a transaction, it is perm

> 11. This method is specified in the Statement interface, and should be used to execute a SELECT statement. 1. execute 2. executeUpdate 3. executeQuery 4. executeSelect 12. This method is specified in the Statement interface, and should be used to execut

> 1. This is the technology that makes it possible for a Java application to communicate with a DBMS. 1. DBMSC 2. JDBC 3. JDBMS 4. JDSQL 2. This is a standard language for working with database management systems. 1. Java 2. COBOL 3. SQL 4. BASIC 3. The

> 11. You use this class to create Border objects. 1. BorderFactory 2. BorderMaker 3. BorderCreator 4. BorderSource 12. True or False: A panel cannot be displayed by itself. 13. True or False: You can place multiple components inside a GridLayout cell.

2.99

See Answer