Questions On Java Basics

10 Questions | Total Attempts: 51

SettingsSettingsSettings
Please wait...
Java Quizzes & Trivia

Java is one of the most used programs by nerds and techs in the world today. If you are one of them, you know practice is key. This quiz helps you practice on it. All the best.


Questions and Answers
  • 1. 
    Programs designed for maintainability are constructed from small simple pieces or modules. Modules in Java are called:
    • A. 

      A.methods.

    • B. 

      B.classes.

    • C. 

      C.arguments.

    • D. 

      D.both methods and classes.

  • 2. 
    Which one of these primitive types are unsigned?
    • A. 

      Char

    • B. 

      Long

    • C. 

      Double

    • D. 

      Float

  • 3. 
    GC is  a high  priority thread. True/False?
    • A. 

      True

    • B. 

      False

  • 4. 
    Java supports both multi dimension and nested arrays.True/False?
    • A. 

      False

    • B. 

      True

  • 5. 
    If an object becomes eligible for Garbage Collection and its finalize() method has been called and inside this method the object becomes accessible by a live thread of execution and is not garbage collected. Later at some point the same object becomes eligible for Garbage collection, will the finalize() method be called again?
    • A. 

      True

    • B. 

      False

  • 6. 
        public class GCTest3 {    GCTest3 g;        public static void main(String [] str){         GCTest3 gc1 = new GCTest3();        GCTest3 gc2 = new GCTest3();        gc1.g = gc2; //gc1 refers to gc2        gc2.g = gc1; //gc2 refers to gc1        gc1 = null;        gc2 = null;        }     }                                  Which Object is eligible for garbage collection? 
    • A. 

      Gc1

    • B. 

      Gc2

    • C. 

      Gc1 and gc2

    • D. 

      GCTest3

  • 7. 
    Why is Java Architectural Neutral? 
    • A. 

      Because it supports Object Oriented Concepts

    • B. 

      Because it provides powerful exception handling mechanisms

    • C. 

      Because it is Platform Independent

    • D. 

      Because it supports Multi-threading

  • 8. 
    What is "Stop the World"? 
    • A. 

      When GC occurs ,the thread where the collection occures should be interrupted.

    • B. 

      Application suspended because of deadlock

    • C. 

      Both A and B

    • D. 

      None of the above

  • 9. 
    -XX:NewRatio=3: ,what does this mean?
    • A. 

      Set the size of Eden space relative to the size of a survivor space.

    • B. 

      Set the size of the Young Generation as a ratio of the size of the Old Generation

    • C. 

      Set the size of survivor space relative to the size of a Old Generation

    • D. 

      None of the above.

  • 10. 
    How Can you tell the system to perform a garbage collection? 
    • A. 

      System.gc();

    • B. 

      Garbage colelction can't be forced

    • C. 

      RunTime.gc();

    • D. 

      System.gc() and RunTime.gc()

Back to Top Back to top