adplus-dvertising

Welcome to the Serialization and Networking MCQs Page

Dive deep into the fascinating world of Serialization and Networking with our comprehensive set of Multiple-Choice Questions (MCQs). This page is dedicated to exploring the fundamental concepts and intricacies of Serialization and Networking, a crucial aspect of Java Programming. In this section, you will encounter a diverse range of MCQs that cover various aspects of Serialization and Networking, from the basic principles to advanced topics. Each question is thoughtfully crafted to challenge your knowledge and deepen your understanding of this critical subcategory within Java Programming.

frame-decoration

Check out the MCQs below to embark on an enriching journey through Serialization and Networking. Test your knowledge, expand your horizons, and solidify your grasp on this vital area of Java Programming.

Note: Each MCQ comes with multiple answer choices. Select the most appropriate option and test your understanding of Serialization and Networking. You can click on an option to test your knowledge before viewing the solution for a MCQ. Happy learning!

Serialization and Networking MCQs | Page 3 of 9

Q21.
Which of these interface extends DataInput interface?
Discuss
Answer: (d).ObjectInput
Q22.
Which of these is a method of ObjectInput interface used to deserialize an object from a stream?
Discuss
Answer: (c).Object readObject()
Q23.
Which of these class extend InputStream class?
Discuss
Answer: (b).ObjectInputStream
Q24.
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);
     }
        }
    }
Discuss
Answer: (a).5
Q25.
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;
 }
    }
Discuss
Answer: (d).deserialization
Q26.
Which of these package contains classes and interfaces for networking?
Discuss
Answer: (c).java.net
Q27.
Which of these is a protocol for breaking and sending packets to an address across a network?
Discuss
Answer: (a).TCP/IP
Q28.
How many bits are in a single IP address?
Discuss
Answer: (c).32
Discuss
Answer: (d).Domain Name Service
Q30.
Which of these class is used to encapsulate IP address and DNS?
Discuss
Answer: (c).InetAddress
Page 3 of 9

Suggested Topics

Are you eager to expand your knowledge beyond Java Programming? We've curated a selection of related categories that you might find intriguing.

Click on the categories below to discover a wealth of MCQs and enrich your understanding of Computer Science. Happy exploring!