Question 1 of 25
Hints left: 3
Q1
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);} } }
Q2
In Java, which classes are used for autoboxing and unboxing operations?
Q3
How an object can become serializable?
Q4
What is autoboxing in Java?
Q5
Which operator is used for autoboxing and unboxing in Java?
Q6
Which of these methods is used to know when was the URL last modified?
Q7
Which of these methods is used to know the type of content used in the URL?
Q8
What is the primary benefit of autoboxing in Java?
Q9
In Java, which method can be used to perform unboxing?
Q10
Which of the following statements is true about autoboxing in Java?
Q11
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.
Q12
What happens if you try to unbox a `null` reference in Java?
Q13
Which of the following is an example of autoboxing in Java?
Q14
Which primitive type corresponds to the `Integer` wrapper class in Java?
Q15
Which of these interface abstractes the output of messages from httpd?
Q16
Which of these is a return type of getAddress() method of DatagramPacket class?
Q17
Which of these method of DatagramPacket is used to obtain the byte array of data contained in a datagram?
Q18
What is the result of the following code in Java? Integer x = 5; Integer y = 5; System.out.println(x == y);
Q19
Which of these is a method of ObjectOutput interface used to finalize the output state so that any buffers are cleared?
Q20
Which of these is an interface for control over serialization and deserialization?
Q21
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()); } }
Q22
What will be the output of the following Java program? import java.net.*; class networking { public static void main(String[] args) throws MalformedURLException { URL obj = new URL("https://www.example.com/javamcq"); System.out.print(obj.getPort()); } }
Q23
Which of these class is necessary to implement datagrams?
Q24
Which of these methods are used to find a URL from the cache of httpd?
Q25
Which of these is a full form of DNS?