FXLabs Java Questions: Networking Concepts

Download PDF of This Page (Size: 112K)

Examrace Placement Series prepares you for the toughest placement exams to top companies.

  1. The API doesn't list any constructors for InetAddress-How do I create an InetAddress instance? ANSWER: In case of InetAddress the three methods getLocalHost, getByName, getByAllName can be used to create instances. Eg. InetAddress add1; InetAddress add2; try { add1 = InetAddress. GetByName ( “java. Sun. Com” ); add2 = InetAddress. GetByName ( “199.22. 22.22” ); }catch (UnknownHostException e) { }

  2. Is it possible to get the Local host IP? ANSWER: Yes. Use InetAddress's getLocalHost method.

  3. What's the Factory Method? ANSWER: Factory methods are merely a convention whereby static methods in a class return an instance of that class. The InetAddress class has no visible constructors. To create an InetAddress object, you have to use one of the available factory methods. In InetAddress the three methods getLocalHost, getByName, getByAllName can be used to create instances of InetAddress.

  4. What's the difference between TCP and UDP? ANSWER: These two protocols differ in the way they carry out the action of communicating. A TCP protocol establishes a two way connection between a pair of computers, while the UDP protocol is a one-way message sender. The common analogy is that TCP is like making a phone call and carrying on a two-way communication, while UDP is like mailing a letter.

  5. What is the Proxy Server? ANSWER: A proxy server speaks the client side of a protocol to another server. This is often required when clients have certain restrictions on which servers they can connect to. And when several users are hitting a popular web site, a proxy server can get the contents of the web server's popular pages once, saving expensive internetwork transfers while providing faster access to those pages to the clients. Also, we can get multiple connections for a single server.

  6. What are the seven layers of OSI model? ANSWER: Application, Presentation, Session, Transport, Network, DataLink, Physical Layer.

  7. What is DHCP? ANSWER: Dynamic Host Configuration Protocol, a piece of the TCP/IP protocol suite that handles the automatic assignment of IP addresses to clients.

  8. What is SMTP? ANSWER: Simple Mail Transmission Protocol, the TCP/IP Standard for Internet mails. SMTP exchanges mail between servers; contrast this with POP, which transmits mail between a server and a client.

  9. In OSI N/w architecture, the dialogue control and token management are responsibilities of…

    1. Network

    2. Session

    3. Application

    4. DataLink

    ANSWER: Session Layer.

  10. In OSI N/W Architecture, the routing is performed by ______ Answer: Network Layer.

  11. What Transport Layer does?

ANSWER: It ensures that the mail gets to its destination. If a packet fails to get its destination, it handles the process of notifying the sender and requesting that another packet be sent.