Networking Basics MCQ

Errorlogger
0
1. Which of these package contains classes and interfaces for networking?
a) java.io
b) java.util
c) java.net
d) java.network



2. Which of these is a protocol for breaking and sending packets to an address across a network?
a) TCIP/IP
b) DNS
c) Socket
d) Proxy Server



3. How many ports of TCP/IP are reserved for specific protocols?
a) 10
b) 1024
c) 2048
d) 512



4. How many bits are in a single IP address?
a) 8
b) 16
c) 32
d) 64



5. Which of these is a full form of DNS?
a) Data Network Service
b) Data Name Service
c) Domain Network Service
d) Domain Name Service



6. Which of these class is used to encapsulate IP address and DNS?
a) Datagram Packet
b) URL
c) Inet Address
d) Content Handler



7. What is the output of this program?

  1.     import java.net.*;
  2.     class networking {
  3.         public static void main(String[] args) throws UnknownHostException {
  4.             InetAddress obj1 = InetAddress.getByName("gksquiz.blogspot.com");
  5.             InetAddress obj2 = InetAddress.getByName("gksquiz.blogspot.com");
  6.             boolean x = obj1.equals(obj2); 
  7.             System.out.print(x);
  8.         }
  9.     }
a) 0
b) 1
c) true
d) false



8. What is the output of this program?
  1.     import java.net.*;
  2.     class networking {
  3.         public static void main(String[] args) throws UnknownHostException {
  4.             InetAddress obj1 = InetAddress.getByName("examlogger.blogspot.com");
  5.             InetAddress obj2 = InetAddress.getByName("gksquiz.blogspot.com");
  6.             boolean x = obj1.equals(obj2); 
  7.             System.out.print(x);
  8.         }
  9.     }
a) 0
b) 1
c) true
d) false



9. What is the output of this program?
  1.     import java.io.*;
  2.     class streams {
  3.         public static void main(String[] args) {
  4.             try {
  5.          FileOutputStream fos = new FileOutputStream("serial");
  6.          ObjectOutputStream oos = new ObjectOutputStream(fos);
  7.          oos.writeFloat(3.5);
  8.          oos.flush();
  9.          oos.close();
  10.      }
  11.      catch(Exception e) {
  12.          System.out.println("Serialization" + e);
  13.                 System.exit(0);
  14.             }
  15.      try {
  16.          FileInputStream fis = new FileInputStream("serial");
  17.          ObjectInputStream ois = new ObjectInputStream(fis);
  18.          ois.close();
  19.          System.out.println(ois.available());       
  20.      }
  21.      catch (Exception e) {
  22.                 System.out.print("deserialization");
  23.          System.exit(0);
  24.      }
  25.         }
  26.     }
a) 1
b) 2
c) 3
d) 4



10. What is the output of this program?
  1.     import java.net.*;
  2.     class networking {
  3.         public static void main(String[] args) throws UnknownHostException {
  4.             InetAddress obj1 = InetAddress.getByName("examlogger.blogspot.com");
  5.             System.out.print(obj1.getHostName());
  6.         }
  7.     }
a) examlogger
b) examlogger.blogspot.com
c) www.examlogger.blogspot.com
d) None of the mentioned


Tags

Post a Comment

0Comments

Post a Comment (0)

#buttons=(Accept !) #days=(30)

Our website uses cookies to enhance your experience. Check Now
Accept !