20130423-invent Java Quiz #

10 Questions | Total Attempts: 57

SettingsSettingsSettings
Please wait...
Java Quizzes & Trivia

Questions and Answers
  • 1. 
     What is the difference between private and public functions ?
    • A. 

      Public functions can be used by anyone, private can only be used by other code in the class you are writin

    • B. 

      Public functions are the only ones you can download

    • C. 

      Public functions are free, you have to buy private ones

    • D. 

      Public functions can’t be used

  • 2. 
    With inheritance, a derived subclass object can directly access any *
    • A. 

      public superclass member (and protected subclass members if it's in the same package)

    • B. 

      Protected, public or private superclass member

    • C. 

      Public or private superclass member

    • D. 

      Private superclass member

  • 3. 
    What is a member of a class ?
    • A. 

      a method a method

    • B. 

      A sub-class

    • C. 

      An attribute

    • D. 

      Attribute or method

  • 4. 
    Methods that are marked protected can be called in any subclass of that class.
    • A. 

      True

    • B. 

      False

  • 5. 
    Choose the appropriate data type for this field: weightInKilos      
    • A. 

      char

    • B. 

      boolean

    • C. 

      double

    • D. 

      String

  • 6. 
    What displays from the following statements? String word = "abcde"; for (int i = 0; i <4; i+=2) System.out.print(word[i]);  
    • A. 

      Ab

    • B. 

      Ace

    • C. 

      Bd

    • D. 

      Ac

  • 7. 
    Choose the best definition for a Class.      
    • A. 

      An object definition, containing the data and function elements necessary to create an object

    • B. 

      An action for a program

    • C. 

      A group of students in a class

    • D. 

      none of these

  • 8. 
    What would display from the following statements? int [ ] nums = {1,2,3,4,5,6}; System.out.println((nums[1] + nums[3]));  
    • A. 

      6

    • B. 

      4

    • C. 

      1+3

    • D. 

      2+4

  • 9. 
    Which package do you need to use widgets such as JApplet, JFrame, JPanel and JButton?  
    • A. 

      java.awt

    • B. 

      Java.swing

    • C. 

      Javax.gui

    • D. 

      Javax.swing

  • 10. 
    The methods wait(), notify() and notifyAll() in Object need to be called from synchronized pieces of code.
    • A. 

      True

    • B. 

      False

Back to Top Back to top