Which of these is a method of ObjectInput interface used to deserialize an object from a stream

  • Home /
  • All Categories /
  • Java Programming /
  • Serialization and Networking /

21. Which of these interface extends DataInput interface?
a. Serializable
b. Externalization
c. ObjectOutput
d. ObjectInput

22. Which of these is a method of ObjectInput interface used to deserialize an object from a stream?
a. int read[]
b. void close[]
c. Object readObject[]
d. Object WriteObject[]

Answer: [c].Object readObject[]

23. Which of these class extend InputStream class?
a. ObjectStream
b. ObjectInputStream
c. ObjectOutput
d. ObjectInput

Answer: [b].ObjectInputStream

24. What is the output of this program?
import java.io.*; class streams { public static void main[String[] args] { try { FileOutputStream fos = new FileOutputStream["serial"]; ObjectOutputStream oos = new ObjectOutputStream[fos]; oos.writeInt[5]; oos.flush[]; oos.close[]; } catch[Exception e] { System.out.println["Serialization" + e]; System.exit[0]; } try { int z; FileInputStream fis = new FileInputStream["serial"]; ObjectInputStream ois = new ObjectInputStream[fis]; z = ois.readInt[]; ois.close[]; System.out.println[x]; } catch [Exception e] { System.out.print["deserialization"]; System.exit[0]; } } }
a. 5
b. void
c. serialization
d. deserialization

25. What is the output of this program?
import java.io.*; class serialization { public static void main[String[] args] { try { Myclass object1 = new Myclass["Hello", -7, 2.1e10]; FileOutputStream fos = new FileOutputStream["serial"]; ObjectOutputStream oos = new ObjectOutputStream[fos]; oos.writeObject[object1]; oos.flush[]; oos.close[]; } catch[Exception e] { System.out.println["Serialization" + e]; System.exit[0]; } try { int x; FileInputStream fis = new FileInputStream["serial"]; ObjectInputStream ois = new ObjectInputStream[fis]; x = ois.readInt[]; ois.close[]; System.out.println[x]; } catch [Exception e] { System.out.print["deserialization"]; System.exit[0]; } } } class Myclass implements Serializable { String s; int i; double d; Myclass[String s, int i, double d] { this.d = d; this.i = i; this.s = s; } }
a. -7
b. Hello
c. 2.1E10
d. deserialization

Answer: [d].deserialization

26. Which of these package contains classes and interfaces for networking?
a. java.io
b. java.util
c. java.net
d. java.network

27. Which of these is a protocol for breaking and sending packets to an address across a network?
a. TCP/IP
b. DNS
c. Socket
d. Proxy Server

28. How many bits are in a single IP address?
a. 8
b. 16
c. 32
d. 64

29. Which of these is a full form of DNS?
a. Data Network Service
b. Data Name Service
c. Domain Network Service
d. Domain Name Service

Answer: [d].Domain Name Service

30. Which of these class is used to encapsulate IP address and DNS?
a. DatagramPacket
b. URL
c. InetAddress
d. ContentHandler

Which of these is a method of ObjectOutput interface used to deserialize an object from a stream?

Which of these is method of ObjectOutput interface used to write the object to input or output stream as required? Explanation: writeObject[] is used to write an object into invoking stream, it can be input stream or output stream. 7.

Which of these is a method of ObjectInputStream used to deserialize?

The ObjectOutputStream class contains writeObject[] method for serializing an Object. The ObjectInputStream class contains readObject[] method for deserializing an object.

Which of these is an interface for control over serialization and Deserialization Mcq?

Explanation : ObjectOutput interface extends the DataOutput interface and supports object serialization.

Is a process of extracting object stream from file stream?

1. Which of these is a process of extracting/removing the state of an object from a stream? Explanation: Deserialization is a process by which the data written in the stream can be extracted out from the stream.

Chủ Đề