CoolInterview.com - World's Largest Collection of Interview Questions & Answers, FAQs, queries, sample papers, exam papers, dumps, what, why, how, where, when questions
Our Services
Get 9,000 Interview Questions & Answers in an eBook.




Get it now !!
Send your Resume to 6000 Companies
Socket Programing Interview Questions & Answers - Learning Mode
COOLINTERVIEW.COM J2EE INTERVIEW QUESTIONS SOCKET PROGRAMING INTERVIEW QUESTIONS QUESTIONS & ANSWERS - LEARNING MODE

Socket Programing Interview Questions & Answers - Learning Mode

Socket programming is used for communication between the applications running on different JRE. Java Socket programming can be connection-oriented or connection-less. Socket and ServerSocket classes are used for connection-oriented socket programming and DatagramSocket and DatagramPacket classes are used for connection-less socket programming.

Try Socket Programing Interview Questions & Answers - Exam Mode

1

Sort By : Latest First | Oldest First | By Rating

Socket Programing Interview Questions & Answers - Learning Mode
Try Socket Programing Interview Questions & Answers - Exam Mode
Question: When MalformedURLException and UnknownHostException throws?

Answer: When the specified URL is not connected then the URL throw MalformedURLException and If InetAddress? methods getByName and getLocalHost are unable to resolve the host name they throw an UnknownHostException.
Source: CoolInterview.com
Question: What information is needed to create a TCP Socket?

Answer: The Local System's IP Address and Port Number. And the Remote System?s IPAddress and Port Number.
Source: CoolInterview.com
Question: What interface must an object implement before it can be written to a stream as an object?

Answer: An object must implement the Serializable or Externalizable interface before it can be written to a stream as an object.
Source: CoolInterview.com
Question: What are the two important TCP Socket classes?

Answer: Socket and ServerSocket. ServerSocket is used for normal two-way socket communication. Socket class allows us to read and write through the sockets. getInputStream() and getOutputStream() are the two methods available in Socket class.
Source: CoolInterview.com
Question: What is multiprogramming?


Answer: Multiprogramming is a rapid switching of the CPU back and forth between processes. Source: CoolInterview.com
Question: Name the seven layers of the OSI Model and describe them briefly.


Answer: Physical Layer - covers the physical interface between devices and the rules by which bits are passed from one to another.
Data Link Layer - attempts o make the physical link reliable and provides the means to activate, maintain, and deactivate the link.
Network Layer - provides for the transfer of information between end systems across
some sort communications network.
Transport Layer - provides a mechanism for the exchange of data between end system.
Session Layer - provides the Source: CoolInterview.com
Question: What Is a Socket in Java Networking and RMI?

Answer: A socket is one end-point of a two-way communication link between two programs running on the network. A socket is bound to a port number so that the TCP layer can identify the application that data is destined to be sent. Socket classes are used to represent the connection between a client program and a server program. The java.net package provides two classes?Socket and ServerSocket?which implement the client side of the connection and the server side of the connection, respectively.
Source: CoolInterview.com
Question: What is the difference between the File and RandomAccessFile classes?

Answer: The File class encapsulates the files and directories of the local file system. The RandomAccessFile class provides the methods needed to directly access data contained in any part of a file.
Source: CoolInterview.com
Question: How does the race condition occur?

Answer: It occurs when two or more processes are reading or writing some shared data and the final result depends on who runs precisely when. Source: CoolInterview.com
Question: What is RMI?

Answer: RMI is a set of APIs that allows to build distributed applications. RMI uses interfaces to define remote objects to turn local method invocations into remote method invocations.
Source: CoolInterview.com
Question: What is the difference between URL instance and URLConnection instance?

Answer: A URL instance represents the location of a resource, and a URLConnection instance represents a link for accessing or communicating with the resource at the location.
Source: CoolInterview.com
Question: How do I make a connection to URL?

Answer: You obtain a URL instance and then invoke openConnection on it. URLConnection is an abstract class, which means you can?t directly create instances of it using a constructor. We have to invoke openConnection method on a URL instance, to get the right kind of connection for your URL. Eg. URL url;

URLConnection connection;
try {
url = new URL(???);
connection = url.openConnection();
} catch (MalFormedURLException e) { }
Source: CoolInterview.com
Question: What is the difference between a NULL pointer and a void pointer?


Answer: A NULL pointer is a pointer of any type whose value is zero. A void pointer is a pointer to an object of an unknown type, and is guaranteed to have enough bits to hold a pointer to any object. A void pointer is not guaranteed to have enough bits to point to a function (though in general practice it does). Source: CoolInterview.com
Question: What does a socket consists of?


Answer: The combination of an IP address and a port number is called a socket. Source: CoolInterview.com
Question: What are some advantages and disadvantages of Java Sockets?

Answer: Advantages of Java Sockets:
Sockets are flexible and sufficient. Efficient socket based programming can be easily implemented for general communications.
Sockets cause low network traffic. Unlike HTML forms and CGI scripts that generate and transfer whole web pages for each new request, Java applets can send only necessary updated information.

Disadvantages of Java Sockets:
Security restrictions are sometimes overbearing because a Java applet running in a Web browser is only able Source: CoolInterview.com
Question: What is encapsulation technique?


Answer: Hiding data within the class and making it available only through the methods. This technique is used to protect your class against accidental changes to fields, which might leave the class in an inconsistent state. Source: CoolInterview.com
Question: What is the difference between TCP and UDP?


Answer: TCP and UDP are both transport-level protocols. TCP is designed to provide reliable communication across a variety of reliable and unreliable networks and internets. <br>UDP provides a connectionless service for application-level procedures. Thus, UDP is basically an unreliable service; delivery and duplicate protection are not guaranteed. Source: CoolInterview.com
Question: What does RMI stand for?

Answer: It stands for Remote Method Invocation. Source: CoolInterview.com

1



India News Network
Latest 20 Questions
Payment of time- barred debt is: (a) Valid (b) Void (c) Illegal (d) Voidable
Consideration is defined in the Indian Contract Act,1872 in: (a) Section 2(f) (b) Section 2(e) (c) Section 2(g) (d) Section 2(d)
Which of the following is not an exception to the rule, "No consideration, No contract": (a) Natural love and affection (b) Compensation for involuntary services (c) Completed gift (d) Agency
Consideration must move at the desire of: (a) The promisor (b) The promisee (c) The promisor or any other party (d) Both the promisor and the promisee
An offer which is open for acceptance over a period of time is: (a) Cross Offer (b) Counter Offer (c) Standing Offer (d) Implied Offer
Specific offer can be communicated to__________ (a) All the parties of contract (b) General public in universe (c) Specific person (d) None of the above
_________ amounts to rejection of the original offer. (a) Cross offer (b) Special offer (c) Standing offer (d) Counter offer
A advertises to sell his old car by advertising in a newspaper. This offer is caleed: (a) General Offer (b) Special Offer (c) Continuing Offer (d) None of the above
In case a counter offer is made, the original offer stands: (a) Rejected (b) Accepted automatically (c) Accepted subject to certain modifications and variations (d) None of the above
In case of unenforceable contract having some technical defect, parties (a) Can sue upon it (b) Cannot sue upon it (c) Should consider it to be illegal (d) None of the above
If entire specified goods is perished before entering into contract of sale, the contract is (a) Valid (b) Void (c) Voidable (d) Cancelled
______________ contracts are also caled contracts with executed consideration. (a) Unilateral (b) Completed (c) Bilateral (d) Executory
A offers B to supply books @ Rs 100 each but B accepts the same with condition of 10% discount. This is a case of (a) Counter Offer (b) Cross Offer (c) Specific Offer (d) General Offer
_____________ is a game of chance. (a) Conditional Contract (b) Contingent Contract (c) Wagering Contract (d) Quasi Contract
There is no binding contract in case of _______ as one's offer cannot be constructed as acceptance (a) Cross Offer (b) Standing Offer (c) Counter Offer (d) Special Offer
An offer is made with an intention to have negotiation from other party. This type of offer is: (a) Invitation to offer (b) Valid offer (c) Voidable (d) None of the above
When an offer is made to the world at large, it is ____________ offer. (a) Counter (b) Special (c) General (d) None of the above
Implied contract even if not in writing or express words is perfectly _______________ if all the conditions are satisfied:- (a) Void (b) Voidable (c) Valid (d) Illegal
A specific offer can be accepted by ___________. (a) Any person (b) Any friend to offeror (c) The person to whom it is made (d) Any friend of offeree
An agreement toput a fire on a person's car is a ______: (a) Legal (b) Voidable (c) Valid (d) Illegal
Cache = 0.21875 Seconds