Question 1 of 25
Hints left: 3
Q1
Which of these methods is used to know host of an URL?
Q2
Which of these class is used for operating on request from the client to the server?
Q3
Which of these is a standard for communicating multimedia content over email?
Q4
What will be the output of the following Java code? 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; } }
Q5
How many ports of TCP/IP are reserved for specific protocols?
Q6
In Java Networking, which class is used for creating a UDP socket?
Q7
Default Serialization process cannot be overridden.
Q8
In Java Networking, what is the purpose of the `ServerSocket` class?
Q9
What is serialization?
Q10
Which protocol is commonly used for web communication in Java Networking?
Q11
What will be the output of the following Java program? import java.io.*; class Chararrayinput { public static void main(String[] args) { String obj = "abcdefgh"; int length = obj.length(); char c[] = new char[length]; obj.getChars(0, length, c, 0); CharArrayReader input1 = new CharArrayReader(c); CharArrayReader input2 = new CharArrayReader(c, 1, 4); int i; int j; try { while ((i = input1.read()) == (j = input2.read())) { System.out.print((char)i); } } catch (IOException e) { e.printStackTrace(); } } }
Q12
What is the purpose of the `java.net` package in Java?
Q13
What will be the output of the following Java 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; } }
Q14
Which of the following methods is used to avoid serialization of new class whose super class already implements Serialization?
Q15
Which of these methods is used to make raw MIME formatted string?
Q16
Which of these method of httpd class is used to write UrlCacheEntry object into local disk?
Q17
Which of these is a wrapper around everything associated with a reply from an http server?
Q18
Which Java class is used to represent a URL (Uniform Resource Locator)?
Q19
Which of these is a process of writing the state of an object to a byte stream?
Q20
Which of these methods is used to know the full URL of an URL object?
Q21
What will be the output of the following Java code? 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); } } }
Q22
In Java Serialization, what is the purpose of the `serialVersionUID` field?
Q23
Which of these interface extends DataOutput interface?
Q24
What is the primary use of the `java.io` package in Java?
Q25
Which of these method is used to start a server thread?