Socket Programming Interview Questions With Answers Part 1

on 9:25 AM

This is the first episode of Socket Programming Interview Questions with Answers

  • What Is a Socket?
  • Question 1: How does the race condition occur?
  • Question 2: What is multiprogramming?
  • Question 3: Name the seven layers of the OSI Model and describe them briefly.
  • Question 4: What is the difference between TCP and UDP?
  • Question 5: What does a socket consists of?
  • QUESTION: What is a JavaBean? (asked by Lifescan inc)
  • QUESTION: What are the seven layers(OSI model) of networking? (asked by Caspio.com)
  • QUESTION: What are some advantages and disadvantages of Java Sockets? (asked by Arashsoft.com)
  • QUESTION: What is the difference between a NULL pointer and a void pointer? (asked by Lifescan inc)
  • QUESTION: What is encapsulation technique? (asked by Microsoft)
What Is a Socket?
A socket is one end-point of a two-way communication link between two programs running on the network. 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--that implement the client side of the connection and the server side of the connection, respectively.
Question 1: 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.
Question 2: What is multiprogramming?
Multiprogramming is a rapid switching of the CPU back and forth between processes
Question 3: 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.
Question 4: 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 
Question 5: What does a socket consists of?
The combination of an IP address and a port number is called a socket.
QUESTION: What is a JavaBean? (asked by Lifescan inc)
ANSWER: JavaBeans are reusable software components written in the Java programming language, designed to be manipulated visually by a software develpoment environment, like JBuilder or VisualAge for Java. They are similar to Microsoft’s ActiveX components, but designed to be platform-neutral, running anywhere there is a Java Virtual Machine (JVM).
QUESTION: What are the seven layers(OSI model) of networking? (asked by Caspio.com)
ANSWER: 1.Physical, 2.Data Link, 3.Network, 4.Transport, 5.Session, 6.Presentation and 7.Application Layers.
QUESTION: What are some advantages and disadvantages of Java Sockets? (asked by Arashsoft.com)
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 to establish connections to the machine where it came from, and to nowhere else on the network

Despite all of the useful and helpful Java features, Socket based communications allows only to send packets of raw data between applications. Both the client-side and server-side have to provide mechanisms to make the data useful in any way.

Since the data formats and protocols remain application specific, the re-use of socket based implementations is limited.
QUESTION: What is the difference between a NULL pointer and a void pointer? (asked by Lifescan inc)
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).
QUESTION: What is encapsulation technique? (asked by Microsoft)
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.

Here are the list of some Computer Networking - Socket Programming Interview Questions
  1. User(s) are complaining of delays when using the network. What would you do?
  2. What are some of the problems associated with operating a switched LAN?
  3. Name some of the ways of combining TCP/IP traffic and SNA traffic over the same link.
  4. What sort of cabling is suitable for Fast Ethernet protocols?
  5. What is a Class D IP address?
  6. Why do I sometimes lose a server's address when using more than one server?
  7. What is Firewall?
  8. How do I monitor the activity of sockets?
  9. How would I put my socket in non-blocking mode?
  10. What are RAW sockets?
  11. What is the role of TCP protocol and IP protocol.
  12. What is UDP?
  13. How can I make my server a daemon?
  14. How should I choose a port number for my server?
  15. Layers in TCP/IP
  16. How can I be sure that a UDP message is received?
  17. How to get IP header of a UDP message
  18. Writing UDP/SOCK_DGRAM applications
  19. How many bytes in an IPX network address?
  20. What is the difference between MUTEX and Semaphore?
  21. What is priority inversion?
  22. Different Solutions to dining philosophers problem.
  23. What is a message queue?
  24. Questions on Shared Memory.
  25. What is DHCP?
  26. Working of ping, telnet, gopher.
  27. Can I connect two computers to internet using same line ?
  28. Working of TCP and SSL Handshake
  29. How P2P softwares work?
  30. Setting up TOMCAT web service
  31. Port numbers for FTP, HTTP, telnet, POP, finger
  32. Difference - Passive FTP, Active FTP
  33. Maximum Transmission Unit (MTU) what is it?
  34. Security threats due to use of CGI
  35. What is "spoofing"
  36. Where could you find Apache server web log
  37. Find web visitors by country
  38. What is Virtual Private Network (VPN) and how does it work?
  39. How does routing work?











1 comments:

Raju said...

nice

Post a Comment