This section presents you various set of Mock Tests related to Java Framework. You can download these sample mock tests at your local machine and solve offline at your convenience. Every mock test is supplied with a mock test key to let you verify the final score and grade yourself.
Q 1 - What is Serialization?
Serialization is the process of writing the state of an object to a byte stream.
Q 2 - What is Deserialization?
Deserialization is the process of restoring state of an object from a byte stream.
Q 3 - What is a transient variable?
A transient variable is a variable that may not be serialized during Serialization and which is initialized by its default value during de-serialization.
Q 4 - What is synchronization?
Synchronization is the capability to control the access of multiple threads to shared resources. synchronized keyword in java provides locking which ensures mutual exclusive access of shared resource and prevent data race.
Q 5 - Does garbage collection guarantee that a program will not run out of memory?
Garbage collection does not guarantee that a program will not run out of memory. It is possible for programs to use up memory resources faster than they are garbage collected. It is also possible for programs to create objects that are not subject to garbage collection.
Q 6 - Under what conditions is an object's finalize() method invoked by the garbage collector?
The garbage collector invokes an object's finalize() method when it detects that the object has become unreachable.
Q 7 - Which arithmetic operations can result in the throwing of an ArithmeticException?
Integer / and % can result in the throwing of an ArithmeticException.
Yes, try statements be nested.
Q 9 - What will happen if static modifier is removed from the signature of the main method?
Program throws "NoSuchMethodError" error at runtime.
No, a top level class can not be private or protected. It can have either "public" or no modifier.
It is not necessary that each try block must be followed by a catch block. It should be followed by either a catch block or a finally block.
Q 12 - Is it necessary that each try block must be followed by a finally block?
It is not necessary that each try block must be followed by a finally block. It should be followed by either a catch block or a finally block.
Q 13 - What is runtime polymorphism?
Runtime polymorphism or dynamic method dispatch is a process in which a call to an overridden method is resolved at runtime rather than at compile-time. In this process, an overridden method is called through the reference variable of a superclass.
No, constructor cannot be inherited.
Deletion in linked list is fast because it involves only updating the next pointer in the node before the deleted node and updating the previous pointer in the node after the deleted node.
Q 16 - What is currentThread()?
currentThread() is a public static method of Thread class used to obtain a reference to the current thread.
All threads must implement the run() method.
Q 18 - What is a marker interface?
Marker interface is an interface with no method.
Q 19 - Which of the following is a marker interface?
serializable is a marker interface.
Q 20 - Which of the following is a thread safe?
StringBuffer is thread safe.
Q 21 - Which of the following is Faster, StringBuilder or StringBuffer?
StringBuilder is faster than StringBuffer.
Postfix operators i.e ()  . is at the highest precedence.
Q 23 - This is the parent of Error and Exception classes.
Throwable is the parent of both Error and Exception class.
Q 24 - When finally block gets executed?
Always when try block get executed, no matter exception occured or not.
Q 25 - In which case, a program is expected to recover?
A program is expected to recover if an exception occurs.
|Question Number||Answer Key|