Java Programming Basics
Test your knowledge of Java programming fundamentals including OOP concepts, exception handling, serialization, access modifiers, constructors, and core language features.
Questions
What is the current java version number and its name?
- Standard Edition 7 and Tiger
- Standard Edition 7 and Dolphin
- Standard Edition 6 and Mustang
- Standard Edition 6 and Dolphin
- Standard Edition 7 and Mustang
Which of the following variable types is/are not serializable in Java?
- Instance
- Static
- Transient
- Both 1 and 2
- Both 2 and 3
Which of the following is a thread safe class in Java?
- StringBuffer
- ArrayList
- HashMap
- StringBuilder
- String
What is the 'out' in the System.out.println() statement in Java?
- PrintWriter class object defined in System class
- Bufferwriter class defined in System class
- System class object
- PrintStream class defined in System class
- BufferReader class object
Which of the following is the drawback of java when compared with other programming languages?
- Having multi threading feature
- Not having low level programming support
- Having robustness
- Not having pointers
- Not having struct data type
Which of the following is a false statement?
- Catch statement can rethrow an exception in Java.
- Empty catch block is accepted by Java.
- Main is a daemon thread.
- Garbage collector is a daemon thread.
- Garbage collector can also run forcibly.
How to get the descriptive information about the exception occurred in a program?
- multiple catch statements
- single catch with exception type as Exception
- printQueueTrace();
- printStackTrace();
- printLinkedlistTrace();
Which of the following is not an advantage of innerclass in Java?
- Maintainability is easier.
- Encapslation is easily achieved.
- Better accesibility restrictions
- Inner class members are hidden from outer class.
- Inheritance is easily achieved.
Which of the following access modifers is assigned to a varible in java class, if explicitly, nothing is mentioned?
- Public
- Private
- Protected
- Default type
- It causes compile time error.
Choose the correct statement about the abstract class.
- An abstract class can be instantiated and must have a main method.
- An abstract class cannot be instantiated but has a main method.
- An abstract class cannot be instantiated and does not have a main method.
- An abstract class must be instantiated and does not have a main method.
- An abstract class also contains abstract methods.
Which of the following is not a marker interface?
- java.io.Serializable
- java.lang.Cloneable
- java.util.EventListener
- Java.util.stack
- None of the above
Which of the following statements is not true?
- Constructor cannot be declared as final.
- Constructor returns the value.
- Constructor is just like a method invoked at the time of object creation.
- Constructor cannot be inherited.
- Constructor cannot be overloaded.
Which of the following are the main features of Java?
- Abstraction, inheritance, encapsulation, polymorphism
- Atomicity, polymorphism, interface
- Abstraction, inheritance, isolation
- Inheritance, encapsulation, durabilty
- Portability, consistency, durability
In which of the following siituations does finally block execute?
- Return statement in catch block.
- System.exit() present in catch block.
- Exception occurred in finally block.
- The death of thread occurs before completion of execution.
- Break; statement in catch block.
Which of the following statements is/are true regarding a constructor?
- Calling one constructor from other constructor is possible.
- The default value of the Boolean type is false.
- The garbage collector invokes an object's finalize() method, when it detects that the object has become unreachable.
- 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.
- All of the above