Friday

Socket Programming Interview Questions And Answers

How does the race condition occur?
It occurs when two or more processes are reading or writing some shared data and the final result depends on who runs precisely when.

What is multiprogramming?
Multiprogramming is a rapid switching of the CPU back and forth between processes.

Name the seven layers of the OSI Model and describe them briefly.
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 mechanism for controlling the dialogue between applications in end systems.
Presentation Layer - defines the format of the data to be exchanged between applications and offers application programs a set of data transformation services.
Application Layer - provides a means for application programs to access the OSI environment.

What is the difference between TCP and UDP?
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.

UDP provides a connectionless service for application-level procedures. Thus, UDP is basically an unreliable service; delivery and duplicate protection are not guaranteed.

What does a socket consists of?
The combination of an IP address and a port number is called a socket.

What is the difference between a NULL pointer and a void pointer?
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).

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.

No comments: