Copro2 Final Exam

50 Questions

Settings
Please wait...
Industry Quizzes & Trivia

50 items


Questions and Answers
  • 1. 
    To run a Java ____, you must use either a Web browser or an applet viewer.
    • A. 

      Program

    • B. 

      Application

    • C. 

      Applet

    • D. 

      Method

  • 2. 
    Consider the following program. public class HelloWorld { public static void main(String[] args) {                System.out.print("Hello World ") } } The missing semicolon in the code above will be caught by the ____.
    • A. 

      Compiler

    • B. 

      assembler

    • C. 

      Editor

    • D. 

      Run

  • 3. 
    Which of the following is a reserved word in Java?
    • A. 

      Char

    • B. 

      CHAR

    • C. 

      Char

    • D. 

      None of these

  • 4. 
    Which package is automatically imported by the Java system?
    • A. 

      Java.io

    • B. 

      Java.util

    • C. 

      Java.lang

    • D. 

      Java.applet

  • 5. 
    It represents or models things in the real world.
    • A. 

      Object

    • B. 

      Class

    • C. 

      Entity

    • D. 

      All of the choices

  • 6. 
    It is an event, usually some form of error which happens during the normal course of program execution.
    • A. 

      Exception Handling

    • B. 

      Error

    • C. 

      Exception

    • D. 

      Error Handling

  • 7. 
    It is a classification of objects which can’t be touched but do exist.
    • A. 

      Tangible objects

    • B. 

      Physical

    • C. 

      Conceptual

    • D. 

      Logical

  • 8. 
    Which of the following statements describe the key aspects about the syntax of the try-catch-finally blocks? I.          The block notation is mandatory. II.         For each try block, there can be one or more catch blocks, but at most only one finally block. III.       A try block must be followed by atleast one catch block or one finally block. IV.       Each catch block can define one or more exception handle. V.        The exception must be of the Throwable class or one of its subclasses.
    • A. 

      I, III and IV only

    • B. 

      II, III and V only

    • C. 

      I, II, III and V only

    • D. 

      All of the choices

  • 9. 
    It refers to the hiding of attributes and methods within an object.
    • A. 

      Information Hiding

    • B. 

      Encapsulation

    • C. 

      Abstraction

    • D. 

      Inheritance

  • 10. 
    Which of the following are NOT an example of a Physical object?I.       Person II.     Course III.    Teacher IV.    Department V.     Professor
    • A. 

      I, II and V

    • B. 

      I, III and V only

    • C. 

      II, III and IV only

    • D. 

      II and IV only

  • 11. 
    This method of Graphics object is useful for drawing  pie-shaped pieces of a circle or oval.
    • A. 

      DrawOval( )

    • B. 

      FillArc( )

    • C. 

      DrawRoundRect( )

    • D. 

      DrawCircle( )

  • 12. 
    Which of the following is the method of ActionListener interface?
    • A. 

      Public void actionPerformed(ActionEvent e)

    • B. 

      Public void actionPerformed( )

    • C. 

      ActionPerformed(ActionEvent e)

    • D. 

      Public static void actionPerformed( )

  • 13. 
    It is the keyword in Java used for instance methods or constructor to refer to the object on which thecurrently executing method has been invoked.
    • A. 

      Super

    • B. 

      This

    • C. 

      Static

    • D. 

      Void

  • 14. 
    Which of the following is NOT a method of MouseListener interface?
    • A. 

      MouseMoved()

    • B. 

      MouseClicked()

    • C. 

      MousePressed()

    • D. 

      MouseReleased()

  • 15. 
    It is a layout manager which divides a rectangular screen area into five regions.
    • A. 

      GridBagLayout

    • B. 

      BoxLayout

    • C. 

      GridLayout

    • D. 

      BorderLayout

  • 16. 
    It is the keyword used for implementing an interface.
    • A. 

      Extends

    • B. 

      Implements

    • C. 

      Throws

    • D. 

      Import

  • 17. 
     It is an access modifier that specifies that class members are accessible to anyone, both inside outside of the class.
    • A. 

      Public

    • B. 

      Protected

    • C. 

      Private

    • D. 

      Default

  • 18. 
    It is the process by which an operating system allocates processor time to each running thread.
    • A. 

      Thread priority

    • B. 

      Thread synchronization

    • C. 

      Thread scheduling

    • D. 

      Thread time slicing

  • 19. 
    It is a type of method that is used to write or change the value of  a member field.
    • A. 

      Static method

    • B. 

      Accessor method

    • C. 

      Mutator method

    • D. 

      Final method

  • 20. 
    Which of the following is the correct signature of method drawString()?
    • A. 

      DrawString()

    • B. 

      DrawString(String str, int x, int y)

    • C. 

      DrawString(int x, Sting str, int y)

    • D. 

      DrawString(int x, int y, String str)

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

      A drawRect method with 4 parameters.

    • B. 

      A fillArc method with 6 parameters.

    • C. 

      A fillRoundRect method with 4 parameters

    • D. 

      A fillRect method with 4 parameters

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

      Destructed

    • B. 

      Destroyed

    • C. 

      Damaged

    • D. 

      Overlapped

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

      Measured in pixels

    • B. 

      Measured in inches

    • C. 

      In decimal places

    • D. 

      In float type

  • 24. 
     To change the color for your drawings, you have to use ______ method.
    • A. 

      GetColor

    • B. 

      SetColor

    • C. 

      DrawColor

    • D. 

      FillColor

  • 25. 
    Which of the following is NOT a subclass of class Component
    • A. 

      TextField

    • B. 

      Button

    • C. 

      Choice

    • D. 

      Label

  • 26. 
     It prepares your applet to accept event messages.
    • A. 

      Event programming

    • B. 

      Event-driven programming

    • C. 

      Java applet programming

    • D. 

      Java application

  • 27. 
    You can provide animations in java by combining different methods of drawing and using _______
    • A. 

      SetColor

    • B. 

      Conditional statements

    • C. 

      ActionListener

    • D. 

      Loop

  • 28. 
    It is an interface class that aligns your components so that they neither crowd each other nor overlap
    • A. 

      Layout

    • B. 

      Flow layout

    • C. 

      Layout managers

    • D. 

      Java layout

  • 29. 
     which of the following is NOT a type of layout:
    • A. 

      FlowLayout

    • B. 

      GridLayout

    • C. 

      GridBagLayout

    • D. 

      BagLayout

  • 30. 
     The GridLayout constructor takes 4 arguments and these are
    • A. 

      Left, right, top, bottom

    • B. 

      Top, right, bottom, left

    • C. 

      Cols, rows, ver, hor

    • D. 

      Rows, cols, hor, ver

  • 31. 
    A communication from the outside world to the program that something has occurred
    • A. 

      Event handling

    • B. 

      Event

    • C. 

      Action event

    • D. 

      Action performed

  • 32. 
    This method means that the mouse leaves the component area.
    • A. 

      MouseOut

    • B. 

      MouseAway

    • C. 

      MouseExited

    • D. 

      MouseLeaved

  • 33. 
    What is another name for a base class?
    • A. 

      Superclass

    • B. 

      Derived class

    • C. 

      Child class

    • D. 

      Hierarchy class

  • 34. 
         It is a method used by the Thread object to pause for a specified number of milliseconds.
    • A. 

      Sleep(int)

    • B. 

      Wait(int)

    • C. 

      Run()

    • D. 

      Stop()

  • 35. 
    These are serious errors in the Java runtime system
    • A. 

      Error

    • B. 

      Exception

    • C. 

      Runtime Exception

    • D. 

      User Exception

  • 36. 
    Threads with the same priority are called _________.
    • A. 

      Sequence

    • B. 

      Thread

    • C. 

      Monitor

    • D. 

      Peers

  • 37. 
     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();

  • 38. 
    Which of the following statements is true?
    • A. 

      Errors are more serious than Exceptions

    • B. 

      Exceptions are more serious than Errors

    • C. 

      Errors and Exceptions are equally serious

    • D. 

      Exceptions and errors are same thing

  • 39. 
    The file method canWrite returns a _________value.
    • A. 

      Integer

    • B. 

      Boolean

    • C. 

      Object

    • D. 

      Void

  • 40. 
    When you perform an input operation in a java program, you use a ___________.
    • A. 

      Pipeline

    • B. 

      Channel

    • C. 

      Moderator

    • D. 

      Stream

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

      Paint

    • B. 

      Color

    • C. 

      Draw

    • D. 

      Graphics

  • 42. 
    What type of exception will you use if your program attempt to divide a value to zero?
    • A. 

      NullPointerExcption

    • B. 

      ArithmeticException

    • C. 

      ArrayIndexOutOfBounds

    • D. 

      D. IOExcption

  • 43. 
    What type of exception will you use if you are trying to access a non-existing index?
    • A. 

      NullPointerException

    • B. 

      StringIndexOutOfBoundsException

    • C. 

      ArrayIndexOutOfBoundsException

    • D. 

      IOException

  • 44. 
    The following are the different constructors that can be used to create File object except?
    • A. 

      A. File(String directoryPath)

    • B. 

      B. File(String directoryPath, String filename)

    • C. 

      C. File(File dirPath, String filename)

    • D. 

      D. File(File dirObj, String filename)

  • 45. 
    The character streams are used to transfer _______ of characters.
    • A. 

      8 bits

    • B. 

      8 bytes

    • C. 

      16 bits

    • D. 

      32 bytes

  • 46. 
    ____ are pieces of information that are sent into, or passed to, a method, usually because the method requires the information to perform its task or carry out its purpose.
    • A. 

      Applets

    • B. 

      Arguments

    • C. 

      Methods

    • D. 

      Objects

  • 47. 
      A state of a thread that might be blocked, waiting indefinitely, or waiting for a specified time
    • A. 

      Inactive

    • B. 

      Interrupted

    • C. 

      Wait

    • D. 

      New

  • 48. 
     It acts as a gatekeeper, ensuring that only one thread at a time has access to data.
    • A. 

      Blocker

    • B. 

      Controller

    • C. 

      Monitor

    • D. 

      Synchronize

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

      Components

    • B. 

      Containers

    • C. 

      Applets

    • D. 

      Constituents

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

      Search engine

    • B. 

      Compiler

    • C. 

      Browser

    • D. 

      Server