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

Question 36 1. 1. Which of the following is true about the following code 2. 2.

ID: 3857341 • Letter: Q

Question

Question 36
1. 1.    Which of the following is true about the following code
2. 2.  

        A.    The program will run and generate the output "MyError1"
        B.    The program will run and generate the output "RuntimeException"
        C.    The program aborts with an exception
        D.    A compile error at line 11 will occur because doit needs to surround the throw statement with try-catch logic, or change it's declaration to:void doit throws MyError1
        E.    The program will run and generate the output "Exception"
Question 37
1. 1.    The following block of code creates a Thread using a Runnable target:
Runnable target = new MyRunnable();Thread myThread = new Thread (target);
Which of the following classes can be used to create the target, so that the preceding code compiles correctly?
A.    public class MyRunnable extends Object {public void run() {/* Some Code */}}
B.    public class MyRunnable implements Thread{public void run(){/* Some Code */}}
C.    public class MyRunnable implements Runnable{public void run() {/* Some Code */}}
D.    public class MyRunnable extends Runnable{public void run(){ /* Some Code */}}
Question 38
1. 1.    You can write binary class instances to this Output buffering class.
        A.    OutputStream
        B.    ObjectOutputStream
        C.    PrintStream
        D.    FileOutputStream
Question 39
1. 1.    This interface is useful for identifying the location of where the user does a mouse click
        A.    MouseEvent
        B.    MousePressed
        C.    MouseListener
        D.    MouseClick
Question 40
1. 1.    This class has methods that allow you to create directories, delete files, and rename files.
A.    Directory
B.    FileSystem
C.    File
D.    fileSystem
Question 41
1. 1.    This class provides useful information about a particular font. For example the height size of the font can be obtained from this class.
A.    FontMetrics
B.    FontInfo
C.    FontSizes
D.    FontInformation

Question 42
1. 1.    This is a class which implements the LayoutManager interface and has a philosophy of placing components into optional regions. These regions are often labeled North, South, Center, etc.
2. 2.            A.    ToolBarLayout
        B.    BorderLayout
        C.    RegionLayout
        D.    Regions
Question 43
1. 1.    This low level abstract class is used for reading a stream of bytes
        A.    ObjectInputStream
        B.    Reader
        C.    InputStream
        D.    FileInputStream
Question 44
1. 1.    If you add the following statement to your code:
addMouseListener( xclass );
What must be true about xclass
A.    xclass will contain all of the methods defined in the MouseListener interface.
B.    xclass will extend the class MouseListener
C.    xclass will be an inner class.
D.    xclass will contain a MouseListener class inside of it.
Question 45
1. 1.    An instance of this class is passed to the paint method. This class has many methods related to drawing.
        A.    Event
        B.    Object
        C.    Graphics
        D.    Canvas
Question 46
1. 1.    This class provides buffering for OutputStreams. This class has a lot of overloaded methods named either print or println.
        A.    PrintStream
        B.    Writer
        C.    WriteStream
        D.    FileStream
Question 47
1. 1.    This low level abstract class is used for writing a stream of "char"s
        A.    Writer
        B.    OutputStream
        C.    WriteStream
        D.    Output
Question 48
1. 1.    This class can be constructed to create a Reader class that is associated with a file open for reading.
        A.    FileReader
        B.    Reader
        C.    File
        D.    FileInputStream
Question 49
1. 1.    Which of the following methods is defined by the Runnable interface?
2. 2.            A.    start()
        B.    stop()
        C.    resume()
        D.    run()
        E.    sleep()
Question 50
1. 1.    This interface is useful for collecting the user's keystrokes
2. 2.            A.    Scanner
        B.    nextLine
        C.    KeyListener
        D.    InputListener
Question 51
1. 1.    This is an interface that is used for classes which are interested in managing the location and sizes of all of the components in a container.
        A.    ComponenentListener
        B.    LayoutListener
        C.    LayoutManager
        D.    ComponentManager
Question 52
1. 1.    one of the methods in the MouseListener interface
        A.    mouseDragged
        B.    mouseMotion
        C.    mousePressed
        D.    mouseEvent
Question 53
1. 1.    This class can be constructed to create an OutputStream class that is associated with a file open for writing
        A.    FileWriter
        B.    File
        C.    FileOutputStream
        D.    OutputStream
Question 54
1. 1.    This method in the Graphics class can be used to draw a circle
2. 2.            A.    drawCircle
        B.    drawOval
        C.    drawRound
        D.    paintOval
Question 55
1. 1.    This is a class which implements the LayoutManager interface and has a philosophy of placing components left to right. When it runs out of room, it starts a new "row" of components.
        A.    InputStream
        B.    RowLayout
        C.    StreamLayout
        D.    FlowLayout
Question 56


1. 1.    Which statement is true about the following code
2. 2.   

A.    If the file abc.txt exists, this code will read the first string found on the line into the variable "s"
B.    If the file abc.txt exists, this code will read the first line of text into the variable "s"
C.    A compile error occurs because this code cannot throw an "IOException"
D.    A compile error occurs because we need to surround line 10 with try-catch logic to catch a "FileNotFoundException"
Question 57
1. 1.    This kind of class cannot be constructed. However, classes derived from this class can be constructed if they override the appropriate methods.
A.    Implementable class
B.    Object
C.    Serializable
D.    Abstract class
Question 58
1. 1.    This class can be constructed to create an InputStream class that is associated with a file open for reading.
        A.    Input
        B.    FileInputStream
        C.    FileReader
        D.    Stream
Question 59
1. 1.    This class can be constructed to create a Writer class that is associated with a file open for writing
        A.    FileWriter
        B.    FileOutputStream
        C.    OutputStream
        D.    File
Question 60
1. 1.    This class is used to create a buffering class for the Reader class. This class contains a method called readLine.
        A.    BufferedReader
        B.    Reader
        C.    ObjectInputStream
        D.    BufferedInputStream

Explanation / Answer

37 and 38 code not available.

39. C

40. C

41. A

42. B

43. D

44. A

45. C

46. A

47. B

48. B

49. D

50. C

51. C

52. C

53. A

54. B

55. D

56. NO CODE AVAILABLE

57. B

58. C

59. D

60. A

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