Java Programming Basics

Test your knowledge of Java programming fundamentals including OOP concepts, exception handling, serialization, access modifiers, constructors, and core language features.

15 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

What is the current java version number and its name?

  1. Standard Edition 7 and Tiger
  2. Standard Edition 7 and Dolphin
  3. Standard Edition 6 and Mustang
  4. Standard Edition 6 and Dolphin
  5. Standard Edition 7 and Mustang
Question 2 Multiple Choice (Single Answer)

Which of the following variable types is/are not serializable in Java?

  1. Instance
  2. Static
  3. Transient
  4. Both 1 and 2
  5. Both 2 and 3
Question 3 Multiple Choice (Single Answer)

Which of the following is a thread safe class in Java?

  1. StringBuffer
  2. ArrayList
  3. HashMap
  4. StringBuilder
  5. String
Question 4 Multiple Choice (Single Answer)

What is the 'out' in the System.out.println() statement in Java?

  1. PrintWriter class object defined in System class
  2. Bufferwriter class defined in System class
  3. System class object
  4. PrintStream class defined in System class
  5. BufferReader class object
Question 5 Multiple Choice (Single Answer)

Which of the following is the drawback of java when compared with other programming languages?

  1. Having multi threading feature
  2. Not having low level programming support
  3. Having robustness
  4. Not having pointers
  5. Not having struct data type
Question 6 Multiple Choice (Single Answer)

Which of the following is a false statement?

  1. Catch statement can rethrow an exception in Java.
  2. Empty catch block is accepted by Java.
  3. Main is a daemon thread.
  4. Garbage collector is a daemon thread.
  5. Garbage collector can also run forcibly.
Question 7 Multiple Choice (Single Answer)

How to get the descriptive information about the exception occurred in a program?

  1. multiple catch statements
  2. single catch with exception type as Exception
  3. printQueueTrace();
  4. printStackTrace();
  5. printLinkedlistTrace();
Question 8 Multiple Choice (Single Answer)

Which of the following is not an advantage of innerclass in Java?

  1. Maintainability is easier.
  2. Encapslation is easily achieved.
  3. Better accesibility restrictions
  4. Inner class members are hidden from outer class.
  5. Inheritance is easily achieved.
Question 9 Multiple Choice (Single Answer)

Which of the following access modifers is assigned to a varible in java class, if explicitly, nothing is mentioned?

  1. Public
  2. Private
  3. Protected
  4. Default type
  5. It causes compile time error.
Question 10 Multiple Choice (Single Answer)

Choose the correct statement about the abstract class.

  1. An abstract class can be instantiated and must have a main method.
  2. An abstract class cannot be instantiated but has a main method.
  3. An abstract class cannot be instantiated and does not have a main method.
  4. An abstract class must be instantiated and does not have a main method.
  5. An abstract class also contains abstract methods.
Question 11 Multiple Choice (Single Answer)

Which of the following is not a marker interface?

  1. java.io.Serializable
  2. java.lang.Cloneable
  3. java.util.EventListener
  4. Java.util.stack
  5. None of the above
Question 12 Multiple Choice (Single Answer)

Which of the following statements is not true?

  1. Constructor cannot be declared as final.
  2. Constructor returns the value.
  3. Constructor is just like a method invoked at the time of object creation.
  4. Constructor cannot be inherited.
  5. Constructor cannot be overloaded.
Question 13 Multiple Choice (Single Answer)

Which of the following are the main features of Java?

  1. Abstraction, inheritance, encapsulation, polymorphism
  2. Atomicity, polymorphism, interface
  3. Abstraction, inheritance, isolation
  4. Inheritance, encapsulation, durabilty
  5. Portability, consistency, durability
Question 14 Multiple Choice (Single Answer)

In which of the following siituations does finally block execute?

  1. Return statement in catch block.
  2. System.exit() present in catch block.
  3. Exception occurred in finally block.
  4. The death of thread occurs before completion of execution.
  5. Break; statement in catch block.
Question 15 Multiple Choice (Single Answer)

Which of the following statements is/are true regarding a constructor?

  1. Calling one constructor from other constructor is possible.
  2. The default value of the Boolean type is false.
  3. The garbage collector invokes an object's finalize() method, when it detects that the object has become unreachable.
  4. The dot operator(.) is used to access the instance variables and methods of class objects. It is also used to access classes and sub-packages from a package.
  5. All of the above