603). How an object can become serializable?
[A]If a class implements java.io.Serializable class
[B]If a class or any superclass implements java.io.Serializable interface
[C]Any object is serializable
[D]No object is serializable
Show Answer
Correct Answer: If a class or any superclass implements java.io.Serializable interface
Notes:
Answer: b
Explanation: A Java object is serializable if class or any its superclass implements java.io.Serializable or its subinterface java.io.Externalizable.
604). What is serialization?
[A]Turning object in memory into stream of bytes
[B]Turning stream of bytes into an object in memory
[C]Turning object in memory into stream of bits
[D]Turning stream of bits into an object in memory
Show Answer
Correct Answer: Turning object in memory into stream of bytes
Notes:
Answer: a
Explanation: Serialization in Java is the process of turning object in memory into stream of bytes.
605). What is deserialization?
[A]Turning object in memory into stream of bytes
[B]Turning stream of bytes into an object in memory
[C]Turning object in memory into stream of bits
[D]Turning stream of bits into an object in memory
Show Answer
Correct Answer: Turning stream of bytes into an object in memory
Notes:
Answer: b
Explanation: Deserialization is the reverse process of serialization which is turning stream of bytes into an object in memory.
606). How many methods Serializable has?
Show Answer
Correct Answer: 0
Notes:
Answer: d
Explanation: Serializable interface does not have any method. It is also called a marker interface.
607). What type of members are not serialized?
[A]Private
[B]Protected
[C]Static
[D]Throwable
Show Answer
Correct Answer: Static
Notes:
Answer: c
Explanation: All static and transient variables are not serialized.
608). If member does not implement serialization, which exception would be thrown?
[A]RuntimeException
[B]SerializableException
[C]NotSerializableException
[D]UnSerializedException
Show Answer
Correct Answer: NotSerializableException
Notes:
Answer: c
Explanation: If member of a class does not implement serialization, NotSerializationException will be thrown.
609). Default Serialization process cannot be overridden.
[A]True
[B]False
[C]none
[D]none
Show Answer
Correct Answer: False
Notes:
Answer: b
Explanation: Default serialization process can be overridden.
610). Which of the following methods is used to avoid serialization of new class whose super class already implements Serialization?
[A]writeObject()
[B]readWriteObject()
[C]writeReadObject()
[D]unSerializaedObject()
Show Answer
Correct Answer: writeObject()
Notes:
Answer: a
Explanation: writeObject() and readObject() methods should be implemented to avoid Java serialization.
611). Which of the following methods is not used while Serialization and DeSerialization?
[A]readObject()
[B]readExternal()
[C]readWriteObject()
[D]writeObject()
Show Answer
Correct Answer: readWriteObject()
Notes:
Answer: c
Explanation: Using readObject(), writeObject(), readExternal() and writeExternal() methods Serialization and DeSerialization are implemented.
612). Serializaed object can be transferred via network.
[A]True
[B]False
[C]none
[D]none
Show Answer
Correct Answer: True
Notes:
Answer: a
Explanation: Serialized object can be transferred via network because Java serialized object remains in form of bytes which can be transmitted over network.