52.
What will be the output of the following Java program?
import java.net.*;
public class networking 
{
    public static void main(String[] args) throws UnknownHostException 
    {
        InetAddress obj1 = InetAddress.getByName("cisco.com");
        InetAddress obj2 = InetAddress.getByName("example.com");
        boolean x = obj1.equals(obj2); 
        System.out.print(x);
    }
}

54.
What will be the output of the following Java program?
import java.net.*;
class networking 
{
    public static void main(String[] args) throws UnknownHostException 
    {
        InetAddress obj1 = InetAddress.getByName("example.com");
        InetAddress obj2 = InetAddress.getByName("example.com");
        boolean x = obj1.equals(obj2); 
        System.out.print(x);
    }
}

57.
What will be the output of the following Java program?
import java.io.*;
class streams
{
    public static void main(String[] args)
    {
        try
        {
      FileOutputStream fos = new FileOutputStream("serial");
      ObjectOutputStream oos = new ObjectOutputStream(fos);
      oos.writeFloat(3.5);
      oos.flush();
      oos.close();
  }
  catch(Exception e)
        {
      System.out.println("Serialization" + e);
            System.exit(0);
        }
  try
        {
      FileInputStream fis = new FileInputStream("serial");
      ObjectInputStream ois = new ObjectInputStream(fis);
      System.out.println(ois.available());		    	
  }
  catch (Exception e) 
        {
            System.out.print("deserialization");
      System.exit(0);
  }
    }
}

58.
What is deserialization?

59.
What will be the output of the following Java program?
import java.net.*;
class networking
{
    public static void main(String[] args) throws Exception 
    {
        URL obj = new URL("https://www.example.com/javamcq");
        URLConnection obj1 = obj.openConnection();
        int len = obj1.getContentLength();
        System.out.print(len);
    }
}

Note: Host URL is having length of content 127.

Read More Section(Java Serialization and Networking)

Each Section contains maximum 100 MCQs question on Java Serialization and Networking. To get more questions visit other sections.