1. What is the difference between fork() & exec()?

fork() created a newly independent process that has it's own
space in memory and also has own permission depends upon
what you assign

Using exec() the created process is a sub thread of calling
process. They also share area in memory and so that also
share all permission and resources.

2. What is the difference between a process task and threads?

process and task as synonymous. One or more threads
together form a process. The threads, two or more belong to
same process, share same address space of the process and
can access all the global variable of the process.
Where as two processes can't access each other's address
space and hence cant access their global variable. Two
processes can talk with each other using IPC.

what are the things that are acquired by the child
process from the parent process?

File descriptors [including socket descriptor].
The whole text segment.
Environment variables.
PPID is PID of parent process.

3. What is the difference between a process task and threads and what are the things that are acquired by the child process from the parent process?

Process is an executing program with several components and
1.exec thread
2. PID
3. priority
4. memory context
5. enviornment
6. file descriptors
7. security credentials.
processes began through a process called "fork and exec".
that is when one command starts another, the child process
first forks , the kernel copying over pages of memory from
the present process to a new location for the child process.
The child then execs, executing the new command and
overwriting the data.the thread is , which controls the flow
of the process. A process needs at least one thread.

4. Why bind system call is required in socket programming?

bind system call assigns a name to the unnamed socket.
Binding an address allows a process to register its address
with the system. This makes it possible for other process to
find it.

5. What is the difference between socket & port?

port : a particular port number on a host
socket: a host and a port

-> http port = 80
-> when you fire up google.com
the socket on the server side is google.com:80 this is the server side socket

on your local system where you are browsing the socket is
yourip:port above 1024

6. How to get client port number in server socket programming?

After accepting connection on socket of server side. we can
get the client ip address and port by to functions. These
functions are belonging in "/usr/include/arpa/inet.h" header

Here is some scratch from the code.
socket2 = accept(socket1, (struct sockaddr *)&client, &addrlen);
printf("%dn",(int) ntohs(client.sin_port));