Java Exam The Best

10 Questions | Total Attempts: 45

SettingsSettingsSettings
Please wait...
Java Quizzes & Trivia

I love java the best broother


Questions and Answers
  • 1. 
    What is the file extension of a java source program ?
    • A. 

      Class

    • B. 

      Obj

    • C. 

      Java

    • D. 

      Bin

  • 2. 
    You can recognise a constructor of a class because:
    • A. 

      It has the same name as the class and no return type

    • B. 

      It has the same name as the class and a void return type

    • C. 

      It has the same name as the class and an int return type

    • D. 

      It has an extended name from the class and no return type

  • 3. 
    The primary function of a constructor is to
    • A. 

      Put a class together on the stack and return a pointer to itself

    • B. 

      Contruct all the code that a class can execute and return void

    • C. 

      Make a memory copy of a class and return a pointer to that instance

    • D. 

      Respond to the user that the class is ready to use no pointers involved

  • 4. 
    The place where classes are stored and manipulated is called a
    • A. 

      Pile

    • B. 

      Stack

    • C. 

      Store

    • D. 

      Heap

  • 5. 
    A constructor is called with the keyword
    • A. 

      new

    • B. 

      Old

    • C. 

      This

    • D. 

      There

  • 6. 
    How many constructors can a class have ?
    • A. 

      None but the system will provide one

    • B. 

      As many as required

    • C. 

      Only one

    • D. 

      Only two

  • 7. 
    Whta is the access scope of a variable declared inside a method block
    • A. 

      The whole java class that method is in

    • B. 

      Only from within that method

    • C. 

      The whole java file that method is in

    • D. 

      From any other java file.

  • 8. 
    What is the first line of the first method executed in a java application:
    • A. 

      Public void main (String args) {

    • B. 

      Public static void main ( String args) {

    • C. 

      Public static main (String args) {

    • D. 

      Static void main (String args {

  • 9. 
    Java swing windows applications generally extend JFrame because
    • A. 

      JFrame is a bigger class than JPanel

    • B. 

      JFrame cannot be extended so we never use it

    • C. 

      JFrame put a frame around a DOS window

    • D. 

      The language developers have already prepared JFrame with many useful methods

  • 10. 
    How many bits does an int primitive variable have ?
    • A. 

      64

    • B. 

      32

    • C. 

      16

    • D. 

      8

Back to Top Back to top