NP 2 marks & question Bank Notes - IT & Software

IT & Software: NP 2 marks & question Bank Notes - IT & Software

The document NP 2 marks & question Bank Notes - IT & Software is a part of IT & Software category.
All you need of IT & Software at this link: IT & Software
 Page 1


-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  1 
 
MC7404 - NETWORK PROGRAMMING 
2 MARKS & QUESTION BANK 
 
UNIT – I - INTRODUCTION 
Overview of UNIX OS - Environment of a UNIX process - Process control – 
Process relationships , Signals – Interprocess Communication- overview of 
TCP/IP protocols 
 
1. Draw the architecture diagram of UNIX 
 
 
2. What is Kernel in UNIX OS? 
? The kernel is the heart of the UNIX operating system.  
? It interacts with hardware 
? It is responsible for scheduling running of user and other processes. 
? It is responsible for allocating memory. 
? It is responsible for managing the swapping between memory and disk. 
? It is responsible for moving data to and from the peripherals. 
? It receives service requests from the processes and honours them. 
 
3. Define Shell in UNIX 
? Whenever you login to a Unix system you are placed in a shell program 
? The shell is a command interpreter; it takes each command and passes 
it to the operating system kernel to be acted upon. It then displays the 
results of this operation on your screen. 
? The most commonly available shells are: 
o Bourne shell (sh) 
o C shell (csh) 
o Korn shell (ksh) 
o TC Shell (tcsh) 
o Bourne Again Shell (bash) 
 
4. Define Utilities in UNIX 
? UNIX provides several hundred utility programs, often referred to as 
commands. 
? Divided into six categories 
o File and directory manipulation commands 
o Filters 
o Program development tools such as editors/compilers 
o Text processing 
Page 2


-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  1 
 
MC7404 - NETWORK PROGRAMMING 
2 MARKS & QUESTION BANK 
 
UNIT – I - INTRODUCTION 
Overview of UNIX OS - Environment of a UNIX process - Process control – 
Process relationships , Signals – Interprocess Communication- overview of 
TCP/IP protocols 
 
1. Draw the architecture diagram of UNIX 
 
 
2. What is Kernel in UNIX OS? 
? The kernel is the heart of the UNIX operating system.  
? It interacts with hardware 
? It is responsible for scheduling running of user and other processes. 
? It is responsible for allocating memory. 
? It is responsible for managing the swapping between memory and disk. 
? It is responsible for moving data to and from the peripherals. 
? It receives service requests from the processes and honours them. 
 
3. Define Shell in UNIX 
? Whenever you login to a Unix system you are placed in a shell program 
? The shell is a command interpreter; it takes each command and passes 
it to the operating system kernel to be acted upon. It then displays the 
results of this operation on your screen. 
? The most commonly available shells are: 
o Bourne shell (sh) 
o C shell (csh) 
o Korn shell (ksh) 
o TC Shell (tcsh) 
o Bourne Again Shell (bash) 
 
4. Define Utilities in UNIX 
? UNIX provides several hundred utility programs, often referred to as 
commands. 
? Divided into six categories 
o File and directory manipulation commands 
o Filters 
o Program development tools such as editors/compilers 
o Text processing 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  2 
 
o System administration 
o Miscellaneous  
 
5. Define File I/O operations 
Most Unix file I/O can be performed with six functions:  
? open 
? close 
? read 
? write 
? lseek 
? dup, dup2 
 
6. Define Programs and processes 
Program:  
A program is an executable file residing on disk in a directory. A program is read 
into memory and is executed by the kernel. 
Process:  
? An executing instance of a program. Some operating systems use the 
term task to refer to a program that is being executed.  
? Every process has a unique numeric identifier called the process ID.  
? The process ID is always a non-negative integer. 
 
7. Define Process Control 
The UNIX system provides three primary functions for process control. This 
includes,  
(i) the creation of new processes – fork()  
(ii) Program execution – exec()  
(iii) Process termination – waitpid() 
 
8. Define Process time 
It measures the central processor resources used by a process. Process time is 
measured in clock ticks. Process time is also called CPU time. When we 
measure the execution time of a process, unix system maintains the following 
three values for a process. They are,  
? Clock time.  
? User CPU time.  
? System CPU time. 
 
9. Define Daemons and give an example 
On Single -user workstations, even when the user is absent, dozens of 
background processes, called daemons, are running. These are started 
automatically when the system is booted.  
Example of a Daemon 
A typical daemon is the cron daemon. It wakes up once a minute to check if 
there is any work for it to do. If so, it does the work. Then it goes back to sleep 
until it is time for the next check 
Applications of Daemon 
Daemon are set to check regular back up updates 
Handle incoming and outgoing mail 
Page 3


-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  1 
 
MC7404 - NETWORK PROGRAMMING 
2 MARKS & QUESTION BANK 
 
UNIT – I - INTRODUCTION 
Overview of UNIX OS - Environment of a UNIX process - Process control – 
Process relationships , Signals – Interprocess Communication- overview of 
TCP/IP protocols 
 
1. Draw the architecture diagram of UNIX 
 
 
2. What is Kernel in UNIX OS? 
? The kernel is the heart of the UNIX operating system.  
? It interacts with hardware 
? It is responsible for scheduling running of user and other processes. 
? It is responsible for allocating memory. 
? It is responsible for managing the swapping between memory and disk. 
? It is responsible for moving data to and from the peripherals. 
? It receives service requests from the processes and honours them. 
 
3. Define Shell in UNIX 
? Whenever you login to a Unix system you are placed in a shell program 
? The shell is a command interpreter; it takes each command and passes 
it to the operating system kernel to be acted upon. It then displays the 
results of this operation on your screen. 
? The most commonly available shells are: 
o Bourne shell (sh) 
o C shell (csh) 
o Korn shell (ksh) 
o TC Shell (tcsh) 
o Bourne Again Shell (bash) 
 
4. Define Utilities in UNIX 
? UNIX provides several hundred utility programs, often referred to as 
commands. 
? Divided into six categories 
o File and directory manipulation commands 
o Filters 
o Program development tools such as editors/compilers 
o Text processing 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  2 
 
o System administration 
o Miscellaneous  
 
5. Define File I/O operations 
Most Unix file I/O can be performed with six functions:  
? open 
? close 
? read 
? write 
? lseek 
? dup, dup2 
 
6. Define Programs and processes 
Program:  
A program is an executable file residing on disk in a directory. A program is read 
into memory and is executed by the kernel. 
Process:  
? An executing instance of a program. Some operating systems use the 
term task to refer to a program that is being executed.  
? Every process has a unique numeric identifier called the process ID.  
? The process ID is always a non-negative integer. 
 
7. Define Process Control 
The UNIX system provides three primary functions for process control. This 
includes,  
(i) the creation of new processes – fork()  
(ii) Program execution – exec()  
(iii) Process termination – waitpid() 
 
8. Define Process time 
It measures the central processor resources used by a process. Process time is 
measured in clock ticks. Process time is also called CPU time. When we 
measure the execution time of a process, unix system maintains the following 
three values for a process. They are,  
? Clock time.  
? User CPU time.  
? System CPU time. 
 
9. Define Daemons and give an example 
On Single -user workstations, even when the user is absent, dozens of 
background processes, called daemons, are running. These are started 
automatically when the system is booted.  
Example of a Daemon 
A typical daemon is the cron daemon. It wakes up once a minute to check if 
there is any work for it to do. If so, it does the work. Then it goes back to sleep 
until it is time for the next check 
Applications of Daemon 
Daemon are set to check regular back up updates 
Handle incoming and outgoing mail 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  3 
 
 
10. Define Fork 
The fork system call creates an exact copy of the original process. The forking 
process is called the parent process. The new process is called the child 
process. The parent and child each have their own, private memory images. 
If the parent subsequently changes any of its variables, the changes are not 
visible to the child, and vice versa 
 
11. Define Process termination in UNIX 
There are eight ways for a process to terminate. These eight ways are divided 
under two categories. They are  
(a) Normal termination.  
(b) Abnormal termination.  
Normal termination occurs in five ways. They are,  
1. Return from main  
2. Calling exit  
3. Calling_exit or _Exit  
4. Return of the last thread from its start routine  
5. Calling pthread_exit from the last thread  
Abnormal termination occurs in three ways. They are,  
6. Calling abort  
7. Receipt of signal  
8. Response of the last thread to a cancellation request  
 
12. Differentiate exit() and _exit() 
1. _exit() : System calls that request the O.S. to terminate a process 
immediately without any additional code execution. 
2. exit() : C Standard Library exit procedure that will cleanly terminate a 
process by invoking additional code as requested by the user and to 
manage ongoing I/O. 
 
13. Define how C program is composed 
o Text segment 
o Initialised data segment 
o Uninitialised data segment 
o Stack 
o Heap 
 
14. Define Signals 
A signal is an asynchronous event which is delivered to a process. Signals are 
called as software interrupts 
Asynchronous means that the event can occur at any time 
– may be unrelated to the execution of the process 
e.g. user types ctrl-C, or the modem hangs 
 
 
Page 4


-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  1 
 
MC7404 - NETWORK PROGRAMMING 
2 MARKS & QUESTION BANK 
 
UNIT – I - INTRODUCTION 
Overview of UNIX OS - Environment of a UNIX process - Process control – 
Process relationships , Signals – Interprocess Communication- overview of 
TCP/IP protocols 
 
1. Draw the architecture diagram of UNIX 
 
 
2. What is Kernel in UNIX OS? 
? The kernel is the heart of the UNIX operating system.  
? It interacts with hardware 
? It is responsible for scheduling running of user and other processes. 
? It is responsible for allocating memory. 
? It is responsible for managing the swapping between memory and disk. 
? It is responsible for moving data to and from the peripherals. 
? It receives service requests from the processes and honours them. 
 
3. Define Shell in UNIX 
? Whenever you login to a Unix system you are placed in a shell program 
? The shell is a command interpreter; it takes each command and passes 
it to the operating system kernel to be acted upon. It then displays the 
results of this operation on your screen. 
? The most commonly available shells are: 
o Bourne shell (sh) 
o C shell (csh) 
o Korn shell (ksh) 
o TC Shell (tcsh) 
o Bourne Again Shell (bash) 
 
4. Define Utilities in UNIX 
? UNIX provides several hundred utility programs, often referred to as 
commands. 
? Divided into six categories 
o File and directory manipulation commands 
o Filters 
o Program development tools such as editors/compilers 
o Text processing 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  2 
 
o System administration 
o Miscellaneous  
 
5. Define File I/O operations 
Most Unix file I/O can be performed with six functions:  
? open 
? close 
? read 
? write 
? lseek 
? dup, dup2 
 
6. Define Programs and processes 
Program:  
A program is an executable file residing on disk in a directory. A program is read 
into memory and is executed by the kernel. 
Process:  
? An executing instance of a program. Some operating systems use the 
term task to refer to a program that is being executed.  
? Every process has a unique numeric identifier called the process ID.  
? The process ID is always a non-negative integer. 
 
7. Define Process Control 
The UNIX system provides three primary functions for process control. This 
includes,  
(i) the creation of new processes – fork()  
(ii) Program execution – exec()  
(iii) Process termination – waitpid() 
 
8. Define Process time 
It measures the central processor resources used by a process. Process time is 
measured in clock ticks. Process time is also called CPU time. When we 
measure the execution time of a process, unix system maintains the following 
three values for a process. They are,  
? Clock time.  
? User CPU time.  
? System CPU time. 
 
9. Define Daemons and give an example 
On Single -user workstations, even when the user is absent, dozens of 
background processes, called daemons, are running. These are started 
automatically when the system is booted.  
Example of a Daemon 
A typical daemon is the cron daemon. It wakes up once a minute to check if 
there is any work for it to do. If so, it does the work. Then it goes back to sleep 
until it is time for the next check 
Applications of Daemon 
Daemon are set to check regular back up updates 
Handle incoming and outgoing mail 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  3 
 
 
10. Define Fork 
The fork system call creates an exact copy of the original process. The forking 
process is called the parent process. The new process is called the child 
process. The parent and child each have their own, private memory images. 
If the parent subsequently changes any of its variables, the changes are not 
visible to the child, and vice versa 
 
11. Define Process termination in UNIX 
There are eight ways for a process to terminate. These eight ways are divided 
under two categories. They are  
(a) Normal termination.  
(b) Abnormal termination.  
Normal termination occurs in five ways. They are,  
1. Return from main  
2. Calling exit  
3. Calling_exit or _Exit  
4. Return of the last thread from its start routine  
5. Calling pthread_exit from the last thread  
Abnormal termination occurs in three ways. They are,  
6. Calling abort  
7. Receipt of signal  
8. Response of the last thread to a cancellation request  
 
12. Differentiate exit() and _exit() 
1. _exit() : System calls that request the O.S. to terminate a process 
immediately without any additional code execution. 
2. exit() : C Standard Library exit procedure that will cleanly terminate a 
process by invoking additional code as requested by the user and to 
manage ongoing I/O. 
 
13. Define how C program is composed 
o Text segment 
o Initialised data segment 
o Uninitialised data segment 
o Stack 
o Heap 
 
14. Define Signals 
A signal is an asynchronous event which is delivered to a process. Signals are 
called as software interrupts 
Asynchronous means that the event can occur at any time 
– may be unrelated to the execution of the process 
e.g. user types ctrl-C, or the modem hangs 
 
 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  4 
 
15. List various signal sources 
? Hardware - division by zero 
? Kernel – notifying an I/O device for which a process has been waiting is 
available 
? Other Processes – a child notifies its parent that it has terminated 
? User – key press (i.e., Ctrl-C) 
 
16. List few examples for signals 
They are accessed by the header file <signal.h> 
value symbol purpose 
1 SIGHUP hangup on control terminal 
2 SIGINT interrupt from keyboard (Ctrl-c) 
3 SIGQUIT quit from keyboard (Ctrl-\) 
8 SIGFPE floating point exception (e.g. divide by 0) 
9 SIGKILL terminate receiving process 
14 SIGALRM end of alarm() system call timeout 
15 SIGTERM default kill command signal 
17 SIGCHLD child process stopped or terminated 
19 SIGSTOP stop execution from keyboard Ctrl-z 
 
17. Define IPC 
InterprocessCommunication (IPC) enables processes to communicate with each 
other to share information 
 
 
 
Interprocess communication has 2 forms 
 
18. Mention the usage of IPC 
1) Synchronization---Used to coordinate access to resources among processes 
and also to coordinate the execution of these processes. They are 
Record locking, 
Semaphores, 
Mutexes and Condition variables. 
2) Message Passing---Used when processes wish to exchange information. 
Message passing takes several forms such as : 
Page 5


-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  1 
 
MC7404 - NETWORK PROGRAMMING 
2 MARKS & QUESTION BANK 
 
UNIT – I - INTRODUCTION 
Overview of UNIX OS - Environment of a UNIX process - Process control – 
Process relationships , Signals – Interprocess Communication- overview of 
TCP/IP protocols 
 
1. Draw the architecture diagram of UNIX 
 
 
2. What is Kernel in UNIX OS? 
? The kernel is the heart of the UNIX operating system.  
? It interacts with hardware 
? It is responsible for scheduling running of user and other processes. 
? It is responsible for allocating memory. 
? It is responsible for managing the swapping between memory and disk. 
? It is responsible for moving data to and from the peripherals. 
? It receives service requests from the processes and honours them. 
 
3. Define Shell in UNIX 
? Whenever you login to a Unix system you are placed in a shell program 
? The shell is a command interpreter; it takes each command and passes 
it to the operating system kernel to be acted upon. It then displays the 
results of this operation on your screen. 
? The most commonly available shells are: 
o Bourne shell (sh) 
o C shell (csh) 
o Korn shell (ksh) 
o TC Shell (tcsh) 
o Bourne Again Shell (bash) 
 
4. Define Utilities in UNIX 
? UNIX provides several hundred utility programs, often referred to as 
commands. 
? Divided into six categories 
o File and directory manipulation commands 
o Filters 
o Program development tools such as editors/compilers 
o Text processing 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  2 
 
o System administration 
o Miscellaneous  
 
5. Define File I/O operations 
Most Unix file I/O can be performed with six functions:  
? open 
? close 
? read 
? write 
? lseek 
? dup, dup2 
 
6. Define Programs and processes 
Program:  
A program is an executable file residing on disk in a directory. A program is read 
into memory and is executed by the kernel. 
Process:  
? An executing instance of a program. Some operating systems use the 
term task to refer to a program that is being executed.  
? Every process has a unique numeric identifier called the process ID.  
? The process ID is always a non-negative integer. 
 
7. Define Process Control 
The UNIX system provides three primary functions for process control. This 
includes,  
(i) the creation of new processes – fork()  
(ii) Program execution – exec()  
(iii) Process termination – waitpid() 
 
8. Define Process time 
It measures the central processor resources used by a process. Process time is 
measured in clock ticks. Process time is also called CPU time. When we 
measure the execution time of a process, unix system maintains the following 
three values for a process. They are,  
? Clock time.  
? User CPU time.  
? System CPU time. 
 
9. Define Daemons and give an example 
On Single -user workstations, even when the user is absent, dozens of 
background processes, called daemons, are running. These are started 
automatically when the system is booted.  
Example of a Daemon 
A typical daemon is the cron daemon. It wakes up once a minute to check if 
there is any work for it to do. If so, it does the work. Then it goes back to sleep 
until it is time for the next check 
Applications of Daemon 
Daemon are set to check regular back up updates 
Handle incoming and outgoing mail 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  3 
 
 
10. Define Fork 
The fork system call creates an exact copy of the original process. The forking 
process is called the parent process. The new process is called the child 
process. The parent and child each have their own, private memory images. 
If the parent subsequently changes any of its variables, the changes are not 
visible to the child, and vice versa 
 
11. Define Process termination in UNIX 
There are eight ways for a process to terminate. These eight ways are divided 
under two categories. They are  
(a) Normal termination.  
(b) Abnormal termination.  
Normal termination occurs in five ways. They are,  
1. Return from main  
2. Calling exit  
3. Calling_exit or _Exit  
4. Return of the last thread from its start routine  
5. Calling pthread_exit from the last thread  
Abnormal termination occurs in three ways. They are,  
6. Calling abort  
7. Receipt of signal  
8. Response of the last thread to a cancellation request  
 
12. Differentiate exit() and _exit() 
1. _exit() : System calls that request the O.S. to terminate a process 
immediately without any additional code execution. 
2. exit() : C Standard Library exit procedure that will cleanly terminate a 
process by invoking additional code as requested by the user and to 
manage ongoing I/O. 
 
13. Define how C program is composed 
o Text segment 
o Initialised data segment 
o Uninitialised data segment 
o Stack 
o Heap 
 
14. Define Signals 
A signal is an asynchronous event which is delivered to a process. Signals are 
called as software interrupts 
Asynchronous means that the event can occur at any time 
– may be unrelated to the execution of the process 
e.g. user types ctrl-C, or the modem hangs 
 
 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  4 
 
15. List various signal sources 
? Hardware - division by zero 
? Kernel – notifying an I/O device for which a process has been waiting is 
available 
? Other Processes – a child notifies its parent that it has terminated 
? User – key press (i.e., Ctrl-C) 
 
16. List few examples for signals 
They are accessed by the header file <signal.h> 
value symbol purpose 
1 SIGHUP hangup on control terminal 
2 SIGINT interrupt from keyboard (Ctrl-c) 
3 SIGQUIT quit from keyboard (Ctrl-\) 
8 SIGFPE floating point exception (e.g. divide by 0) 
9 SIGKILL terminate receiving process 
14 SIGALRM end of alarm() system call timeout 
15 SIGTERM default kill command signal 
17 SIGCHLD child process stopped or terminated 
19 SIGSTOP stop execution from keyboard Ctrl-z 
 
17. Define IPC 
InterprocessCommunication (IPC) enables processes to communicate with each 
other to share information 
 
 
 
Interprocess communication has 2 forms 
 
18. Mention the usage of IPC 
1) Synchronization---Used to coordinate access to resources among processes 
and also to coordinate the execution of these processes. They are 
Record locking, 
Semaphores, 
Mutexes and Condition variables. 
2) Message Passing---Used when processes wish to exchange information. 
Message passing takes several forms such as : 
-------------------------------------------------------------------------------------------------------------------- 
Prepared by : Mrs.M.Nirmala / AP / MCA  5 
 
Pipes, 
FIFOs, 
Message Queues, 
Shared Memory. 
 
19. Define Pipe 
A pipe provides a one way flow of data 
#include <unistd.h> 
int pipe(int fildes[2]); 
fildes[0] is open for reading and fildes[1] is open for 
writing 
The output of fildes[1] is the input for fildes[0] 
 
20. Give an example for PIPE 
//pipe creation and its usage 
#include <stdio.h> 
#include <stdlib.h> 
#include <errno.h> 
#include <sys/types.h> 
#include <unistd.h> 
main() 
{ int pipefd[2], n; 
char buff[100]; 
if (pipe(pipefd) < 0 ) printf("pipe error"); //pipe not created 
printf("read fd = %d, write fd = %d \n", pipefd[0], pipefd[1]); 
printf("\n The word written in pipe  "); 
write(pipefd[1], "HELLO WORLD" , 12); 
n = read(pipefd[0],buff,sizeof(buff)); 
write(1, buff, n); /*fd=1=stdout*/ 
} 
//output 
$ ./a 
read fd = 3, write fd = 4 
 
21. List the properties of PIPE 
1) Pipes do not have a name. For this reason, the processes must share a 
parent process. This is the main drawback to pipes.  
2) Pipes do not distinguish between messages; they just read a fixed number of 
bytes. Newline (\n) can be used to separate messages. A structure with a length 
field can be used for message containing binary data. 
3) Pipes can also be used to get the output of a command or to provide input to 
a command 
 
22. Define FIFO 
A FIFO is similar to a pipe. A FIFO (First In First Out) is a one-way flow of data. 
FIFOs have a name, so unrelated processes can share the FIFO. FIFO is a 
named pipe. This is the main difference between pipes and FIFOs. 
#include <sys/types.h> 
#include <sys/stat.h> 
Read More
Use Code STAYHOME200 and get INR 200 additional OFF
Use Coupon Code

Download free EduRev App

Track your progress, build streaks, highlight & save important lessons and more!

Related Searches

Important questions

,

Extra Questions

,

ppt

,

video lectures

,

Exam

,

Viva Questions

,

NP 2 marks & question Bank Notes - IT & Software

,

past year papers

,

Objective type Questions

,

mock tests for examination

,

practice quizzes

,

shortcuts and tricks

,

study material

,

pdf

,

Free

,

NP 2 marks & question Bank Notes - IT & Software

,

NP 2 marks & question Bank Notes - IT & Software

,

MCQs

,

Sample Paper

,

Previous Year Questions with Solutions

,

Semester Notes

,

Summary

;