Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

35 Any of the file input or output methods in a Java program might throw an exce

ID: 3915325 • Letter: 3

Question

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.

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?

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?

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?

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 __________.

finally

Explanation / Answer

35) try, if the code in the try block trows exception it can be handled by catch block, so code needs to be put in try block

36) setColor()

37) setVisible(true), pack method resizes the JFrame to fit the sizes and setVisible is used to display the frame

38) c.setFont(new Font("Helvetica", Font.BOLD, 20))

39) data fields

40) graph.drawString("CAT", 20, 50);

41) final

42) String

43) Create a class that represents the event handler, attach the JFrame to a JWindow object and register the event handler

44) Only (ii)

45) File

46) registerButton

47) 0

48) The program throws an exception and proceeds to execute the finally block.

49) actionPerformed

50) g.drawOval(30, 30, 20, 20)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote