35
Any of the file input or output methods in a Java program might throw an exception, so all the relevant code in the class is placed in a ____ block.
36
You specify 2D colors by using the ____ method.
37
Which JFrame JFrame method is used to display the frame?
38
The method __________ sets the font (Helvetica, 20-point bold) in component C.
| c.setFont(new Font("Helvetica", Font.bold, 20)) |
| c.setFont(new Font("helvetica", BOLD, 20)) |
| c.setFont(Font("Helvetica", Font.BOLD, 20)) |
| c.setFont(new Font("Helvetica", Font.BOLD, 20)) |
39
Usually, the subclass constructor only needs to initialize the ____ that are specific to the subclass.
40
If graph holds a Graphics object, which of the following puts "CAT" starting at X = 20, Y = 50?
| drawString("CAT", 20, 50); |
| graph.drawString(20, 50, "CAT"); |
| graph.drawString("CAT", 20, 50); |
41
The keyword ____ indicates that a field value is unalterable.
42
You define the text to be displayed in a tool tip by using the setToolTipText() method and passing an appropriate ____ to it.
43
Which of the following most completely describes the steps for setting up event handling for a GUI component?
| Create a class that represents the event handler, attach the JFrame to a JWindow object and register the event handler. |
| Implement an appropriate event-listener interface and register the event handler. |
| Create a class that represents the event handler and implement an appropriate event-listener interface. |
| Create a class that represents the event handler, implement an appropriate event-listener interface and register the event handler. |
44
Suppose that the class Mystery is derived from the class Secret. Consider the following statements. Secret secRef = new Secret(); Mystery mysRef = new Mystery(); Which of the following statements is legal in Java? (i) secRef = mysRef; (ii) mysRef = secRef;
45
Which class do you use to read data from a text file?
46
Which method is used to register a listener object to a button object?
47
When using the drawRoundRect() method, if you assign ____ to the arc coordinates, the rectangle is not rounded; instead, the corners are square.
48
What happens in a method if there is an exception thrown in a try block but there is no catch block following the try block?
| The program ignores the exception. |
| The program will not compile without a complete try/catch structure. |
| The program terminates immediately. |
| The program throws an exception and proceeds to execute the finally block. |
49
Which method contains the code that the program executes when a specific event is generated?
50
Given a Graphics object g, to draw an circle with radius 20 centered at (50, 50), you use __________.
| g.drawOval(50, 50, 20, 20) |
| g.drawOval(50, 50, 40, 40) |
| g.drawOval(30, 30, 20, 20) |
| g.drawOval(30, 30, 40, 40) |