views:

16033

answers:

6

Please anybody can tell me the questions, that can be asked in an interview for below topics

  • Socket Programming
  • Multi-Threading

An advance thanks goes to everybody who provide their time

+5  A: 

What is deadlock and how do you avoid it?

Some socket programming questions.

Eclipse
+15  A: 

Socket Programming

  • Difference between UDP and TCP.
  • Difference between asynchronous and synchronous sockets.
  • What is a packet.
  • How'd you determine if packet didn't arrive malformed.
  • How'd you determine where one packet ends and where another one starts.
  • What is a port.

Multi-Threading

  • What synchronization primitives do you know, tell difference between them.
  • What is a deadlock and what is a livelock.
  • What is a race condition.
  • What does the term 'lock-free' mean.
  • What is the best way to terminate a thread.
  • Why you shouldn't use TerminateThread-esque functions.
arul
+4  A: 
  • Why does a typical socket program need multi threading
  • How do you talk to bunch of different network connections at once,from same process/thread? Hint:Asynchronous Socket
  • Explain how Internet datatransfer works? or Explain how a webserver works? answer it based on socket programming concepts , Hint TCP Http etc..
Jobi Joy
"Explain how Internet works?" Unless you are hiring Vint Cerf, that one seems to be overly broad to me.
Rob Adams
How is Innternnet works? How is internnet works? How data get transfarred?
Andy Lester
+4  A: 

A couple of example questions:

  • Asynchronous I/O, one approach is to ask a question where different clients may query the server and may result in race conditions if implemented via multiple threads (e.g. caching of results). If the interviewee goes for multiple threads, bring up the race conditions and see whether they mention asynchronous I/O as an option.
  • What is the difference between dead-lock and live-lock
  • Prototype a web server
  • Prototype a web client
  • What are ephemeral ports; alternatively describe a load stress application that hits a server with 1000s of requests per second but after several seconds stops making requests to the server; after 2-4 minutes the application again starts hitting the server with 1000s of requests.
  • Write a thread-safe producer/consumer buffer that can be accessed by one or more producer/consumers
  • What is the difference between client/server and p2p
  • This is more networking, but it is helpful to know what happens underneath the socket calls: describe the TCP 3-way handshake
  • What is nagle's algorithm? When is it desirable? How would you turn this off?
  • Linux variant: when writing a daemon what are the basic building blocks (i.e. forking a child and killing the parent, closing stdin/stdout/stderr etc.)
  • Windows variant: when writing a windows service what are the basic building blocks.
  • Design a protocol for communicating between a client and a server for sending audio/video. How do you extend it for the next latest/greatest feature.
  • How does TCP windows work and what can I do to optimize performance for an application that performs lots of large reads across continents.
terson
+14  A: 

As a hiring manager, my favorite networking question to ask was this:

Imagine a user sitting at an Ethernet-connected PC. He has a browser open. He types "www.google.com" in the address bar and hits enter.

Now tell me what the first packet to appear on the Ethernet is.

Possible answers (of varying correctness) include:

  • I don't know.
  • An HTTP request packet.
  • A TCP syn packet.
  • A DNS request packet.
  • An ARP packet.
  • It depends.

Each of the answers reveals something about the person's understanding of networking in general, and IP and TCP in particular. The subsequent discussion can reveal volumes about their understanding. (Assuming, of course, that the questioner has some expertise in this area).

Rob Adams
clever question.
Greg Rogers
smart, it pretty connects everything, when explored.
Vivek Sharma
+1  A: 

Are you asking because you've been dragged in to interview someone who will be on your team? Ask questions that are based in real-life problems you've had to face in your day-to-day operations. Think of the last bug you had related to socket programming, and turn it into an interview question.

Theory is nice, but you want to know that the person joining the team has experience in the trenches.

Andy Lester
you'd rather keep the guys who've never heard of deadlocks out of your part of the trenches though. That's what these questions are for...
Jimmy