Copro2 Prefinal Exam

98 Questions

Settings
Please wait...
Industry Quizzes & Trivia

Java applet


Questions and Answers
  • 1. 
    These are small applications and they are accessed in internet server.
    • A. 

      Applications

    • B. 

      Applets

    • C. 

      Java

    • D. 

      Widgets

  • 2. 
    This is the name of the package that you have to import to create and implement your applet code.
    • A. 

      Import java.io.*

    • B. 

      Import java.applet.*;

    • C. 

      Import java.awt.*;

    • D. 

      Import java.awt.event.*;

  • 3. 
    This is the name of the package that you have to import to have an action listeners on your program
    • A. 

      Import java.io.*;

    • B. 

      Import java.applet.*;

    • C. 

      Import java.awt.*;

    • D. 

      Import java.awt.event.*;

  • 4. 
    It can only contain a single line of text and no images.
    • A. 

      Label

    • B. 

      Button

    • C. 

      Textfield

    • D. 

      All of these

  • 5. 
    Which of the following is NOT an applet keyword?
    • A. 

      Transient

    • B. 

      Package

    • C. 

      Interface

    • D. 

      Gotoxy

  • 6. 
    This is the name of the package that you have to import to create and implement your applet code.
    • A. 

      Import java.io.*

    • B. 

      Import java.applet.*;

    • C. 

      Import java.awt.*;

    • D. 

      Import java.awt.event.*;

  • 7. 
    This means that other classes may use this class or method during their execution.
    • A. 

      Public

    • B. 

      Import

    • C. 

      Implement

    • D. 

      Package

  • 8. 
    It tells Java that this is the beginning of a class declaration.
    • A. 

      Public

    • B. 

      Void

    • C. 

      Class

    • D. 

      Static

  • 9. 
    This is the name of the package that you have to import to have an action listeners on your program
    • A. 

      Import java.io.*;

    • B. 

      Import java.applet.*;

    • C. 

      Import java.awt.*;

    • D. 

      Import java.awt.event.*;

  • 10. 
    Which of the following is NOT an applet keyword?
    • A. 

      Transient

    • B. 

      Package

    • C. 

      Interface

    • D. 

      Gotoxy

  • 11. 
    Which of the following is the correct declaration of drawing a rectangle method?
    • A. 

      G.Drawrect();

    • B. 

      G.drawRect();

    • C. 

      G.drawingRect();

    • D. 

      G.draw_RECT();

  • 12. 
    Which of the following is the correct parameters of drawString method?
    • A. 

      (String, int x, int y)

    • B. 

      (String, int y, int x)

    • C. 

      (int x, int y, String)

    • D. 

      (int x, String, int y)

  • 13. 
    This means that other classes may use this class or method during their execution.
    • A. 

      Public

    • B. 

      Import

    • C. 

      Implement

    • D. 

      Package

  • 14. 
    The class used to choose color to your drawings
    • A. 

      SetColor()

    • B. 

      Graphics

    • C. 

      Color

    • D. 

      Paint

  • 15. 
    It tells Java that this is the beginning of a class declaration.
    • A. 

      Public

    • B. 

      Void

    • C. 

      Class

    • D. 

      Static

  • 16. 
    On the given statement below, which of the following is the location below the upper left corner of the applet window?   g.drawString (“Welcome to Java!”, 140, 50);
    • A. 

      ”Welcome to Java!”

    • B. 

      140

    • C. 

      50

    • D. 

      None of these

  • 17. 
    Which of the following is the correct declaration of drawing a rectangle method?
    • A. 

      G.Drawrect();

    • B. 

      G.drawRect();

    • C. 

      G.drawingRect();

    • D. 

      G.draw_RECT();

  • 18. 
    The following are methods in Applet class except:
    • A. 

      Start()

    • B. 

      Stop()

    • C. 

      Destroy()

    • D. 

      Wait()

  • 19. 
    Which of the following is the correct parameters of drawString method?
    • A. 

      (String, int x, int y)

    • B. 

      (String, int y, int x)

    • C. 

      (int x, int y, String)

    • D. 

      (int x, String, int y)

  • 20. 
    This method literally paints graphical elements in an applet window
    • A. 

      Start()

    • B. 

      Init()

    • C. 

      Draw()

    • D. 

      Paint()

  • 21. 
    The class used to choose color to your drawings
    • A. 

      SetColor()

    • B. 

      Graphics

    • C. 

      Color

    • D. 

      Paint

  • 22. 
    The correct HTML tag for passing parameters to applet is:
    • A. 

    • B. 

    • C. 

    • D. 

  • 23. 
    On the given statement below, which of the following is the location below the upper left corner of the applet window?   g.drawString (“Welcome to Java!”, 140, 50);
    • A. 

      ”Welcome to Java!”

    • B. 

      140

    • C. 

      50

    • D. 

      None of these

  • 24. 
    Which of the following is the advantage of passing parameters to an applet
    • A. 

      It avoids confusion in displaying strings in applet.

    • B. 

      You would not need to change and recompile the applet every time you changed the messages.

    • C. 

      You would not need to change your html code every time you changed the messages.

    • D. 

      It makes your program a lot easier to manage than usual.

  • 25. 
    The following are methods in Applet class except:
    • A. 

      Start()

    • B. 

      Stop()

    • C. 

      Destroy()

    • D. 

      Wait()

  • 26. 
    This method literally paints graphical elements in an applet window
    • A. 

      Start()

    • B. 

      Init()

    • C. 

      Draw()

    • D. 

      Paint()

  • 27. 
    The _________class “knows” how to change colors and draw things on the screen.
    • A. 

      Paint

    • B. 

      Color

    • C. 

      Draw

    • D. 

      Graphics

  • 28. 
    The correct HTML tag for passing parameters to applet is:
    • A. 

    • B. 

    • C. 

    • D. 

  • 29. 
    Which of the following is the correct parameters of fillArc method
    • A. 

      (int x, int y, int width, int height, int start angle, int size of angle)

    • B. 

      (int x, int y, int width, int height, int size of angle, int end angle)

    • C. 

      (int x, int y, int height, int width, int size of angle 1, int size of angle 2)

    • D. 

      (int width, int height ,int x, int y, int size of angle 1, int size of angle 2)

  • 30. 
    Which of the following is the advantage of passing parameters to an applet
    • A. 

      It avoids confusion in displaying strings in applet.

    • B. 

      You would not need to change and recompile the applet every time you changed the messages.

    • C. 

      You would not need to change your html code every time you changed the messages.

    • D. 

      It makes your program a lot easier to manage than usual.

  • 31. 
    Which of the following is NOT TRUE regarding parameters of drawRect method?
    • A. 

      You can specify whole numbers only

    • B. 

      You can declare four parameters only

    • C. 

      You can declare negative numbers

    • D. 

      You can declare decimal values.

  • 32. 
    The _________class “knows” how to change colors and draw things on the screen.
    • A. 

      Paint

    • B. 

      Color

    • C. 

      Draw

    • D. 

      Graphics

  • 33. 
    To change the color of your drawings, you have to use the method __________.
    • A. 

      GetColor()

    • B. 

      ChangeColor()

    • C. 

      SetColor()

    • D. 

      InventColor()

  • 34. 
    Which of the following is the correct parameters of fillArc method
    • A. 

      (int x, int y, int width, int height, int start angle, int size of angle)

    • B. 

      (int x, int y, int width, int height, int size of angle, int end angle)

    • C. 

      (int x, int y, int height, int width, int size of angle 1, int size of angle 2)

    • D. 

      (int width, int height ,int x, int y, int size of angle 1, int size of angle 2)

  • 35. 
    To create series of lines in your applet, you have to use the method ________.
    • A. 

      DrawLinear()

    • B. 

      DrawBorder()

    • C. 

      DrawLine()

    • D. 

      FillLine()

  • 36. 
    Which of the following is NOT TRUE regarding parameters of drawRect method?
    • A. 

      You can specify whole numbers only

    • B. 

      You can declare four parameters only

    • C. 

      You can declare negative numbers

    • D. 

      You can declare decimal values.

  • 37. 
    The Component class has the following methods except:
    • A. 

      SetBackground()

    • B. 

      SetForeground()

    • C. 

      SetFont()

    • D. 

      SetAlignment()

  • 38. 
    To change the color of your drawings, you have to use the method __________.
    • A. 

      GetColor()

    • B. 

      ChangeColor()

    • C. 

      SetColor()

    • D. 

      InventColor()

  • 39. 
    Which of the following is NOT true regarding Button class
    • A. 

      It provides a single line of text only.

    • B. 

      You cannot change the font style.

    • C. 

      You cannot change the font size.

    • D. 

      You cannot include background image

  • 40. 
    To create series of lines in your applet, you have to use the method ________.
    • A. 

      DrawLinear()

    • B. 

      DrawBorder()

    • C. 

      DrawLine()

    • D. 

      FillLine()

  • 41. 
    Which of the following is NOT a Label constructor?
    • A. 

      Label sample = new Label();

    • B. 

      Label sample = new Label(“text of label”);

    • C. 

      Label sample = new Label(“text of label”, Label.setText());

    • D. 

      Label sample = new Label(“text of label”, Label.RIGHT);

  • 42. 
    The Component class has the following methods except:
    • A. 

      SetBackground()

    • B. 

      SetForeground()

    • C. 

      SetFont()

    • D. 

      SetAlignment()

  • 43. 
    It is the listener interface for receiving action events.
    • A. 

      ActionEvent

    • B. 

      ActionListener

    • C. 

      ActionPerformed

    • D. 

      ActionImplement

  • 44. 
    Which of the following is NOT true regarding Button class
    • A. 

      It provides a single line of text only.

    • B. 

      You cannot change the font style.

    • C. 

      You cannot change the font size.

    • D. 

      You cannot include background image

  • 45. 
    This method must be override once you implement an action listener class
    • A. 

      AddActionListener

    • B. 

      ActionPerformed

    • C. 

      ActionEvent

    • D. 

      ActionListener

  • 46. 
    Which of the following is NOT a Label constructor?
    • A. 

      Label sample = new Label();

    • B. 

      Label sample = new Label(“text of label”);

    • C. 

      Label sample = new Label(“text of label”, Label.setText());

    • D. 

      Label sample = new Label(“text of label”, Label.RIGHT);

  • 47. 
    It has four constructors that enable one to build the exact object that is needed.
    • A. 

      Text class

    • B. 

      Textlabel

    • C. 

      Textarea

    • D. 

      Textfield

  • 48. 
    The drawString() method is a member of the _____________class.
    • A. 

      Graphics

    • B. 

      String

    • C. 

      Draw

    • D. 

      Applet

  • 49. 
    It is the listener interface for receiving action events.
    • A. 

      ActionEvent

    • B. 

      ActionListener

    • C. 

      ActionPerformed

    • D. 

      ActionImplement

  • 50. 
    The method that places a value within a previously constructed Textfield is ________.
    • A. 

      GetValue

    • B. 

      SetText

    • C. 

      FillText

    • D. 

      SetValue

  • 51. 
    This method must be override once you implement an action listener class
    • A. 

      AddActionListener

    • B. 

      ActionPerformed

    • C. 

      ActionEvent

    • D. 

      ActionListener

  • 52. 
    The add() method ___________.
    • A. 

      Adds two integers

    • B. 

      Adds two numbers of any data type

    • C. 

      Places a component within an Applet window screen

    • D. 

      Places a value in a variable.

  • 53. 
    It has four constructors that enable one to build the exact object that is needed.
    • A. 

      Text class

    • B. 

      Textlabel

    • C. 

      Textarea

    • D. 

      Textfield

  • 54. 
    This method is used to manually change the location of the components
    • A. 

      SetLocation()

    • B. 

      GetLocation()

    • C. 

      ChangeLocation()

    • D. 

      Locate()

  • 55. 
    The drawString() method is a member of the _____________class.
    • A. 

      Graphics

    • B. 

      String

    • C. 

      Draw

    • D. 

      Applet

  • 56. 
    A Font object contains all of the following except ________
    • A. 

      Language

    • B. 

      Typeface

    • C. 

      Style

    • D. 

      Size

  • 57. 
    The method that places a value within a previously constructed Textfield is ________.
    • A. 

      GetValue

    • B. 

      SetText

    • C. 

      FillText

    • D. 

      SetValue

  • 58. 
    The constructor TextField(“4”) creates _________.
    • A. 

      An unlabeled textfield

    • B. 

      A textfield with a “4” in it.

    • C. 

      A textfield four pixels wide

    • D. 

      A textfield four characters wide

  • 59. 
    The add() method ___________.
    • A. 

      Adds two integers

    • B. 

      Adds two numbers of any data type

    • C. 

      Places a component within an Applet window screen

    • D. 

      Places a value in a variable.

  • 60. 
    This method is used to manually change the location of the components
    • A. 

      SetLocation()

    • B. 

      GetLocation()

    • C. 

      ChangeLocation()

    • D. 

      Locate()

  • 61. 
    A user might initiate any number of events in any order in ___________ program.
    • A. 

      An event-driven

    • B. 

      A procedural

    • C. 

      A random

    • D. 

      Any java

  • 62. 
    A Font object contains all of the following except ________
    • A. 

      Language

    • B. 

      Typeface

    • C. 

      Style

    • D. 

      Size

  • 63. 
    This method is used to manually change the size of the components
    • A. 

      SetSize()

    • B. 

      GetSize()

    • C. 

      ChangeSize()

    • D. 

      Resize()

  • 64. 
    The constructor TextField(“4”) creates _________.
    • A. 

      An unlabeled textfield

    • B. 

      A textfield with a “4” in it.

    • C. 

      A textfield four pixels wide

    • D. 

      A textfield four characters wide

  • 65. 
    Java applications and java applets are similar because both ______________.
    • A. 

      Are compiled using the javac command.

    • B. 

      Are executed using the java command

    • C. 

      Are executed from within an HTML document

    • D. 

      Have a main() method.

  • 66. 
    A user might initiate any number of events in any order in ___________ program.
    • A. 

      An event-driven

    • B. 

      A procedural

    • C. 

      A random

    • D. 

      Any java

  • 67. 
    The ending half of any HTML tag pair is preceded with a ___________.
    • A. 

      Dot

    • B. 

      Forward slash

    • C. 

      Backslash

    • D. 

      Colon

  • 68. 
    This method is used to manually change the size of the components
    • A. 

      SetSize()

    • B. 

      GetSize()

    • C. 

      ChangeSize()

    • D. 

      Resize()

  • 69. 
    The name of any applet called using CODE within an HTML document must use the _____________extension.
    • A. 

      .exe

    • B. 

      .code

    • C. 

      .java

    • D. 

      .class

  • 70. 
    Java applications and java applets are similar because both ______________.
    • A. 

      Are compiled using the javac command.

    • B. 

      Are executed using the java command

    • C. 

      Are executed from within an HTML document

    • D. 

      Have a main() method.

  • 71. 
    Labels and Buttons are __________.
    • A. 

      Components

    • B. 

      Containers

    • C. 

      Siblings

    • D. 

      Family

  • 72. 
    The ending half of any HTML tag pair is preceded with a ___________.
    • A. 

      Dot

    • B. 

      Forward slash

    • C. 

      Backslash

    • D. 

      Colon

  • 73. 
    A program that allows you to display HTML documents on your computer screen is a ____________.
    • A. 

      Search engine

    • B. 

      Compiler

    • C. 

      Browser

    • D. 

      Notepad

  • 74. 
    The name of any applet called using CODE within an HTML document must use the _____________extension.
    • A. 

      .exe

    • B. 

      .code

    • C. 

      .java

    • D. 

      .class

  • 75. 
    When an applet is registered as a listener with a button, if a user clicks the button, the method that executes is __________.
    • A. 

      ButtonPressed()

    • B. 

      AddActionListener()

    • C. 

      Start()

    • D. 

      ActionPerformed()

  • 76. 
    TextArea and TextField are both subclasses of _____________.
    • A. 

      TextComponent

    • B. 

      TextBox

    • C. 

      Text

    • D. 

      TextValue

  • 77. 
    Labels and Buttons are __________.
    • A. 

      Components

    • B. 

      Containers

    • C. 

      Siblings

    • D. 

      Family

  • 78. 
    Which of the following statements correctly creates a Font object?
    • A. 

      Font aFont = new Font(“Helvetica”, Font.ITALIC, 20);

    • B. 

      Font aFont = new Font(26, “Times New Roman”, Font.ITALIC);

    • C. 

      Font aFont = new Font(Font.BOLD ,“Helvetica”, , 20);

    • D. 

      Font aFont = new Font(18, Font.BOLD, “Comic Sans”);

  • 79. 
    A program that allows you to display HTML documents on your computer screen is a ____________.
    • A. 

      Search engine

    • B. 

      Compiler

    • C. 

      Browser

    • D. 

      Notepad

  • 80. 
    You can construct a new Color by providing 3 integers that represent ___________, ___________, and ____________ colors
    • A. 

      Red, Orange, Green

    • B. 

      Blue, Green, Yellow

    • C. 

      Red, Green, Blue

    • D. 

      Black, White and Blue

  • 81. 
    When an applet is registered as a listener with a button, if a user clicks the button, the method that executes is __________.
    • A. 

      ButtonPressed()

    • B. 

      AddActionListener()

    • C. 

      Start()

    • D. 

      ActionPerformed()

  • 82. 
    To create circles in your applet, you have to use the method ________.
    • A. 

      DrawCircle()

    • B. 

      DrawCircular()

    • C. 

      DrawOval()

    • D. 

      DrawArc()

  • 83. 
    TextArea and TextField are both subclasses of _____________.
    • A. 

      TextComponent

    • B. 

      TextBox

    • C. 

      Text

    • D. 

      TextValue

  • 84. 
    Which of the following will generate an error:
    • A. 

      A drawRect method with 4 parameters.

    • B. 

      A fillArc method with 6 parameters.

    • C. 

      A drawArc method with 4 parameters

    • D. 

      A fillRect method with 4 parameters

  • 85. 
    Which of the following statements correctly creates a Font object?
    • A. 

      Font aFont = new Font(“Helvetica”, Font.ITALIC, 20);

    • B. 

      Font aFont = new Font(26, “Times New Roman”, Font.ITALIC);

    • C. 

      Font aFont = new Font(Font.BOLD ,“Helvetica”, , 20);

    • D. 

      Font aFont = new Font(18, Font.BOLD, “Comic Sans”);

  • 86. 
    A window that is moved or covered is __________.
    • A. 

      Destructed

    • B. 

      Destroyed

    • C. 

      Damaged

    • D. 

      Overlapped

  • 87. 
    You can construct a new Color by providing 3 integers that represent ___________, ___________, and ____________ colors
    • A. 

      Red, Orange, Green

    • B. 

      Blue, Green, Yellow

    • C. 

      Red, Green, Blue

    • D. 

      Black, White and Blue

  • 88. 
    The distance values for drawRect are ________.
    • A. 

      Measured in pixels

    • B. 

      Measured in inches

    • C. 

      In decimal places

    • D. 

      In float type

  • 89. 
    To create circles in your applet, you have to use the method ________.
    • A. 

      DrawCircle()

    • B. 

      DrawCircular()

    • C. 

      DrawOval()

    • D. 

      DrawArc()

  • 90. 
    Applets are _______.
    • A. 

      Stand-alone program

    • B. 

      Web pages

    • C. 

      Called from within another application

    • D. 

      Written in HTML

  • 91. 
    Which of the following will generate an error:
    • A. 

      A drawRect method with 4 parameters.

    • B. 

      A fillArc method with 6 parameters.

    • C. 

      A drawArc method with 4 parameters

    • D. 

      A fillRect method with 4 parameters

  • 92. 
    A window that is moved or covered is __________.
    • A. 

      Destructed

    • B. 

      Destroyed

    • C. 

      Damaged

    • D. 

      Overlapped

  • 93. 
    It is used to make parts of the library available for used in the current program.
    • A. 

      Public

    • B. 

      Import

    • C. 

      Implements

    • D. 

      Package

  • 94. 
    The distance values for drawRect are ________.
    • A. 

      Measured in pixels

    • B. 

      Measured in inches

    • C. 

      In decimal places

    • D. 

      In float type

  • 95. 
    The applet can  received the parameter values using the method ___________
    • A. 

      GetParam()

    • B. 

      GetParameter()

    • C. 

      SetParam()

    • D. 

      SetParameter()

  • 96. 
    Applets are _______.
    • A. 

      Stand-alone program

    • B. 

      Web pages

    • C. 

      Called from within another application

    • D. 

      Written in HTML

  • 97. 
    It is used to make parts of the library available for used in the current program.
    • A. 

      Public

    • B. 

      Import

    • C. 

      Implements

    • D. 

      Package

  • 98. 
    The applet can  received the parameter values using the method ___________
    • A. 

      GetParam()

    • B. 

      GetParameter()

    • C. 

      SetParam()

    • D. 

      SetParameter()