Vidyalelo
Java Programming · all questions

Java Serialization and Networking
practice.

Practice every MCQ with options. Use Show answers when you want the correct option and solution.

113

Questions

6/6

Page

Pick an option on a question to see the right answer and solution.

Which of these is a return type of getAddress() method of DatagramPacket class?

Select an option to see the answer and solution.

How an object can become serializable?

Select an option to see the answer and solution.

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

Select an option to see the answer and solution.

Which of these methods is used to know when was the URL last modified?

Select an option to see the answer and solution.

Which of these methods are used to find a URL from the cache of httpd?

Select an option to see the answer and solution.

Which of these class is necessary to implement datagrams?

Select an option to see the answer and solution.

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();
        System.out.print(obj1.getLastModified);
    }
}

Note: Host URL was last modified on june 18 tuesday 2013.

Select an option to see the answer and solution.

Which of these is a method of ObjectOutput interface used to finalize the output state so that any buffers are cleared?

Select an option to see the answer and solution.

Which of these methods is used to know the type of content used in the URL?

Select an option to see the answer and solution.

Which of these interface abstractes the output of messages from httpd?

Select an option to see the answer and solution.

Which of these is a full form of DNS?

Select an option to see the answer and solution.

What will be the output of the following Java program?
Note: Host URL is written in html and simple text.
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();
        System.out.print(obj1.getContentType());
    }
}

Select an option to see the answer and solution.

What will be the output of the following Java program?
import java.io.*;  
import java.net.*;  
public class URLDemo 
{  
    public static void main(String[] args) 
    {  
        try 
        {  
            URL url=new URL("https://www.example.com/java-mcq");  
            System.out.println("Protocol: "+url.getProtocol());  
            System.out.println("Host Name: "+url.getHost());  
            System.out.println("Port Number: "+url.getPort());   
        } catch(Exception e){System.out.println(e);}  
    }  
}

Select an option to see the answer and solution.