Operating Systems

Topics:-

              Introduction 
             System Structures 
                                                    Click here to view objectives.....
             Process Concept 
             Multi-thread Programming 
             Process  Scheduling
             Synchronization 
             Deadlocks
                                                      Click here to view objectives.....
3.Memory & File Management
             Memory Management Strategies
             Virtual Memory management
             Secondary Storage Structure
                                                    Click here to view Objectives......
             
           

Memory Management 61-72

1.       The problem of thrashing is effected scientifically by ________.
1 Program structure
2 Program size
3 Primary storage size
4 None of the above
                Ans ) 1
2.       The mechanism that bring a page into memory only when it is needed is called _____________
1 Segmentation
2 Fragmentation
3 Demand Paging
4 Page Replacement
                Ans ) 3
3.        A thread
1 is a lightweight process where the context switching is low
2 is a lightweight process where the context switching is high
3 is used to speed up paging
4 none of the above
                Ans ) 1
4.        A tree structured file directory system
1 allows easy storage and retrieval of file names
2 is a much debated unnecessary feature
3 is not essential when we have millions of files
4 none of the above
                Ans ) 1
5.       Which of the following disk scheduling techniques has a drawback of starvation ?
1 SCAN
2 SSTF
3 FCFS
4 LIFO
                Ans ) 2
6.        A set of resources' allocations such that the system can allocate resources to each process in some order, and still avoid a deadlock is called ________.
1 Unsafe state
2 Safe state
3 Starvation
4 Greedy allocation
                Ans ) 2
7.       What is the first step in performing an operating system upgrade ?
1 Partition the drive
2 Format the drive
3 Backup critical data
4 Backup old operating system
                Ans ) 3
8.       In a virtual memory environment
1 segmentation and page tables are stored in the cache and do not add any substantial overhead
2 slow down the computer system considerable
3 segmentation and page tables are stored in the RAM
4 none of the above
                Ans ) 3
9.        If all page frames are initially empty, and a process is allocated 3 page frames in real memory and references its pages in the order 1 2 3 2 4 5 2 3 2 4 1 and the page replacement is FIFO, the total number of page faults caused by the process will be __________.
1 10
2 7
3 8
4 9
                Ans ) 4
10.   Which of the following is crucial time while accessing data on the disk?
1 Seek time
2 Rotational time
3 Transmission time
4 Waiting time
                Ans ) 1
11.   In the ___________ method of data transfer, the participation of the processor is eliminated during data transfer.
1 Buffering
2 Caching
3 Direct Memory Access
4 Indirect Memory Access
                 Ans ) 3
12.   Data reside in file on disk under DOS environment, which of the following file name is invalid ?
1 OSCONCEPTS.doc
2 RAW
3 COMPAQ.BOOK
4 JUMPSTART.BOS

                Ans ) 3

Memory Management 46-60

1.       Virtual memory is __________.
                                                1 An extremely large main memory
                                                2 An extremely large secondary memory
                                                3 An illusion of extremely large main memory
                                                4 A type of memory used in super computers.
                                                                Ans ) 3
2.        The kernel keeps track of the state of each task by using a data structure called __
1 Process control block
2 User control block
3 Memory control block
4 None of the above
                Ans ) 1
3.        _________ page replacement alogorithm suffers from Belady's anamoly.
1 LRU
2 MRU
3 FIFO
4 LIFO
                Ans ) 3
4.       _________ is a high speed cache used to hold recently referenced page table entries a part of paged virtual memory
1 Translation Look aside buffer
2 Inverse page table
3 Segmented page table
4 All the above
Ans ) 1
5.        If you don’t know which version of MS-DOS you are working with, which command will you use after booting your operating system ?
1 Format command
2 FAT command
3 VER command
4 DISK command
                Ans ) 3
6.       _______ OS pays more attention on the meeting of the time limits.
1 Distributed
2 Network
3 Real time
4 Online
                Ans ) 3
7.       Paging _________.
1 solves the memory fragmentation problem
2 allows modular programming
3 allows structured programming
4 avoids deadlock
                Ans ) 1
8.        A thread is a __________ process .
1 Heavy Weight
2 Mutliprocess
3 Inter Thread
4 Light weight
                Ans ) 4
9.       _________ allocates the largest hole (free fragment) available in the memory.
1 Best Fit
2 Worst Fit
3 First Fit
4 None of the above
Ans ) 2
10.   Number of CPU registers in a system depends on ____________.
1 Operating system
2 Computer Architecture
3 Computer Organization
4 None of the above
                Ans ) 2
11.    Which directory implementation is used in most Operating System?
1 Single level directory structure
2 Two level directory structure
3 Tree directory structure
4 Acyclic directory structure
                Ans ) 3
12.   A page fault occurs
1 when the page is not in the memory
2 when the page is in the memory
3 when the process enters the blocked state
4 when the process is in the ready state
                                                                                Ans ) 1
13.   What is the memory from 1K - 640K called ?
1 Extended Memory
2 Normal Memory
3 Low Memory
4 Conventional Memory
                Ans ) 4
14.   The process related to process control, file management, device management, information about system and communication that is requested by any higher level language can be performed by __________.
1 Editors
2 Compilers
3 System Call
4 Caching
                Ans ) 3
15.   If the Disk head is located initially at 32, find the number of disk moves required with FCFS if the disk queue of I/O blocks requests are 98,37,14,124,65,67.
1 310
2 324
3 315
4 321                Ans ) 4 


Previous page                                                    Next Page

Memory Management 16-30

1.       A disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65, 67 If the head is initially at 53rd cylinder, what will be the total number of cylinders traversed if we are using SSTF disc scheduling algorithm.
1) 156  
2) 236  
3) 366 
4) 456
Answer: 2
2.       The Best-Fit algorithm for allocating regions of contiguous memory does_________ 
1) Scan memory region list from start for first fit
2) Pick the closest free region in the entire list.
3) There is no such algorithm
4) Find the worst fit in the entire list 
Answer: 2
3.       Question: From the given data Bytes/Sector = 500
Sectors/Track = 50
Tracks/Platter = 150
Platters/ Hard Disk = 10
Data Transfer rate = 10 millisecs per byte
Total number of millisecs taken to transfer all the bytes in the hard disk?
1) 500 x 50 x 10 x 10
2) 500 x 50 x 150 x 10 
3) 500 x 50 x 150 x 10 x10 
4) 500 x 150 x 10 x10
Answer: 3
4.       From the given data Bytes/Sector = 500
Sectors/Track = 50
Tracks/Platter = 150
Platters/ Hard Disk = 10
Data Transfer rate = 10 millisecs per byte
Total number of millisecs taken to transfer the bytes from one single platter?
1) 500 x 50 x 150 x 10
 2) 500 x 50 x 10
 3) 500 x 150 x 50 x 10
 4) 500 x 150 x 10 x10
Answer: 1
5.       From the given data Bytes/Sector = 500
Sectors/Track = 50
Tracks/Platter = 150
Platters/ Hard Disk = 10
Data Transfer rate = 10 millisecs per byte
Total number of ms taken to transfer all the bytes from a cylinder cylinder? 
1) 500 x 50 x 10 x 10
2) 500 x 150 x 50
3) 500 x 150 x 10 x10
4) 50 x 150 x 10 x10
Answer: 1
6.        In a Hard disk,  Bytes per sector = 512
Sectors/track = 63
Number of Magnetic disks = 5
Tracks / platter = 50
Total number of bytes in a cylinder is ________
1) 512X 63X 5 
2) 512X 50X 5 
3) 512X 63 X 50 
4) 512 X 5
Answer: 1
7.       In a Hard disk,  Bytes per sector = 512
Sectors/track = 63
Number of Magnetic disks = 5
Tracks / platter = 50
The total number of bytes/platter is _____
1) 512X 63X 5
2) 512X 50X 5
3) 512X 63 X 50 
4) 512 X 5
Answer: 3
8.       In a Hard disk,  Bytes per sector = 512
Sectors/track = 63
Number of Magnetic disks = 5
Tracks / platter = 50
The total number of cylinders in the hard disk is_______.
1) 63 
2) 50 
3) 512 
4) 63 X 5
Answer: 2
9.       The size of single unit of allocation on disk is called ____.
1) Sector size 
2) Page size 
3) Segment size  
4)File size
Answer: 1
10.   Memory utilization factor shall be computed as follows 
(A)   memory in use/allocated memory.
(B)   memory in use/total memory connected.
(C) memory allocated/free existing memory.
 (D) memory committed/total memory available.  
                                Answer: B
11.     ‘LRU’ page replacement policy is                   
(A)    Last Replaced Unit.                 
(B) Last Restored Unit.
(C)  Least Recently Used.               
(D) Least Required Unit.           
Ans: (C)
12.     Nested Macro calls are expanded using the 
(A)    FIFO rule (First in first out)       
 (B)  LIFO (Last in First out)
(C)  FILO rule (First in last out)         
(D)  None of the above                     
Ans: (B) 
13.     A parser which is a variant of top-down parsing without backtracking is       
(A) Recursive Descend.          
 (B) Operator Precedence.                  
 (C) LL(1) parser.                     
  (D) LALR Parser.                                                                       
Ans: (A)    
14.    The expansion of nested macro calls follows 
(A)  FIFO rule.                                 
(B)  LIFO rule. 
(C)  LILO rule.                                
 (D)  priority rule.                         
Ans: (B) 
15.    In a two-pass assembler, the task of the Pass II is to  
(A)  separate the symbol, mnemonic opcode and operand  fields.                                        (B)  build the symbol table.
(C)  construct intermediate code.         
(D) synthesize the target program.                 

                                                Ans: (D)



Previous Page                                                                  Next Page

Memory Management 31-45

1.       A macro definition consists of                                                                                                                                                                                     
                              (A)  A macro prototype statement     
                              (B)  One or more model statements
                              (C)  Macro pre-processor statements 
                              (D)  All of the above
                                                Ans: (D)
2.       Demand paged memory allocation
                                                1 allows the virtual address space to be independent of the physical memory
                                                2 allows the virtual address space to be a multiple of the physical memory size
                                                3 allows deadlock tobe detected in paging schemes
                                                4 is present only in Windows NT
                                                                Ans ) 1
3.        ___________ begins at the root and follows a path down to the specified file
1 Relative path name
2 Absolute path name
3 Standalone name
4 All of the above
                Ans ) 2
4.       The process related to process control, file management, device management, information about system and communication that is requested by any higher level language can be performed by __________.
1 Editors
2 Compilers
3 System Call
4 Caching
                Ans ) 3
5.       What is the name of the software which can be legally compiled and often used for free?
1 Shareware program
2 Public domain program
3 Firmware program
4 Mind Ware
                Ans ) 2
6.       The problem of fragmentation arises in ________.
1 Static storage allocation
2 Stack allocation storage
3 Stack allocation with dynamic binding
4 Heap allocation
                Ans ) 4
7.       Boundary registers ________.
1 Are available in temporary program variable storage
2 Are only necessary with fixed partitions
3 Track the beginning and ending the program
4 Track page boundaries
                Ans ) 3
8.       The principle of locality of reference justifies the use of ________.
1 Virtual Memory
2 Interrupts
3 Main memory
4 Cache memory
                Ans ) 4
9.       In memory management , a technique called as paging, physical memory is broken into fixed-sized blocks called ___________.
1 Pages
2 Frames
3 Blocks
4 Segments
                Ans ) 2
10.   Which of the following file name extension suggests that the file is Backup copy of another file ?
1 TXT
2 COM
3 BAS
4 BAK
                Ans ) 4
11.   The higher versions of operating systems are so written that programs designed for earlier versions can still be run. What is it called ?
1 Up gradiability
2 Upward mobility
3 Universality
4 Upward Compatibility
                Ans ) 4
12.   Which of the following memory allocation scheme suffers from External fragmentation?
1 Segmentation
2 Pure demand paging
3 Swapping
4 Paging
                Ans ) 1
13.   Which file system does DOS typically use ?
1 FAT16
2 FAT32
3 NTFS
4 WNFS
                Ans ) 1
14.   Which file system does Windows 95 typically use ?
1 FAT16
2 FAT32
3 NTFS
4 LMFS
                Ans ) 2
15.   Virtual Memory is commonly implemented by __________.
                                                1 Segmentation
                                                2 Swapping
                                                3 Demand Paging
                                                4 None of the above

                                                                Ans ) 3 



Previous Page                                                                  Next Page

Memory Management 1-15

1.       The term ‘page traffic’ describes                
 (A) number of pages in memory at a given instant.              
 (B) number of papers required to be brought in at a given page request.               
(C)   the movement of pages in and out of memory.              
 (D)  number of pages of executing programs loaded in memory.                   
Ans: (C) 
2.       Which of the following is not related to disk scheduling ?
1) transfer time 
2) waiting time 
3) seek time 
4) rotational latency 
Answer:1
3.       Which of the following is not related to the disk access
1) Wait Time 
2) Transfer Time
3) seek time
4) Latency Time 
Answer:2
4.       Belady’s Anomaly is present in _________
 1) LIFO 
  2)FIFO
  3) FCFS
   4)SJF
Answer:2
5.       If the Disk head is located initially at 32, find the number of disk moves required with FCFS if the disk queues of I/O blocks requests are 98,37,14,124,65,67. 
1) 310  
2) 324  
3) 315 
4) 321
Ans:- (4)
6.       Which of the following is not a disk scheduling algorithm? 
1) SCAN
2) Elevator / LOOK 
3) FCFS
4) Working set
Ans: 4
7.       A disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65, 67 If the head is presently at 53rd cylinder, what will be the total number of cylinders traversed if we are using SCAN disc scheduling algorithm.
1) 152  
2) 252  
3) 352  
4) 462
Answer: 2
8.       A disc queue with requests for I/O to blocks on cylinders. 98, 183, 37, 122, 14, 124, 65, 67 If the head is presently at 53rd cylinder, what will be the total number of cylinders traversed if we are using C-SCAN disc scheduling algorithm.
1) 182 
2) 282 
3) 382 
4) 482
Answer: 3
9.        A disc queue with requests for I/O to blocks on cylinders 98, 183, 37, 122, 14, 124, 65, 67 If the head is presently at 53rd cylinder, what will be the total number of cylinders traversed if we are using C-LOOK disc scheduling algorithm.
1) 155  
2) 255  
3) 355  
4) 455
Answer: 3
10.    In which disc scheduling algorithm the head traverses to the extreme end cylinders.
1) FCFS 
2) SSTF 
3) SCAN 
4) C-LOOK
Answer: 3
11.    In which disc scheduling algorithm the head traverses to the nearest available cylinder.
1) FCFS 
2) SSTF 
3) SCAN 
4) C-LOOK
Answer: 2
12.    In which disc scheduling algorithm  the head traverses to the first cylinder encountered in the given order.
1) FCFS
2) SSTF
3) SCAN
4) C-LOOK
Answer: 1
13.    In which disc scheduling algorithm the head traverses till one end then returns directly to the other end before encountering any other cylinder.
 1) FCFS 
 2) SSTF 
 3) C-SCAN
 4) C-LOOK
 Answer: 3
14.    C-SCAN is also known as ________
1) Circular scan
 2) Cylindrical scan 
3) Constant scan 
4) None
Answer: 1
15.   A disc queue with requests for I/O to blocks on cylinders  98, 183, 37, 122, 14, 124, 65, 67 If the head is presently at 53rd cylinder, what will be the total number of cylinders traversed if we are using FCFS disc scheduling algorithm.
1) 340 
2) 440 
3) 540 
4) 640

Answer: 4



Palindrome Number

#include<stdio.h>
int pal(int n);
void main()
{
    int num,ch=0,rev;
    while(ch!=-1)
    {
        printf("\nPress -1 to  quit:");
        scanf("%d",&ch);
        if(ch==-1)
            break;
        printf("\nEnter the number:");
        scanf("%d",&num);
        rev=pal(num);
        if(rev==num)
            printf("\nResult=%d is palindrome number",num);
        else
            printf("\nResult=%d is not palindrome number",num);
}
}
int pal(int n)
{
   static int digit,rev=0;
         if(n!=0)
        {
            digit=n%10;
            rev=(rev*10)+digit;
            pal(n/10);
        }

return rev;
}

Functions Program List

Fibonacci Series

#include<stdio.h>
int fib(int a)
{
   if(a==0)
        return 0;
   else if(a==1)
        return 1;
   else
    return(fib(a-1)+fib(a-2));

}
void main()
{
    int n,i;
    printf("\nEnter the number of terms");
    scanf("%d",&n);
     for(i=0;i<n;i++)
    printf("\n%d",fib(i));

}

Factorial

#include<stdio.h>
int fact(int a)
{
    int c=1;
    if(a<=1)
        return 1;
    else
        c=a*fact(a-1);
    return c;
}
void main()
{
    int num,f;
    printf("Enter the number");
    scanf("%d",&num);
    f=fact(num);
    printf("Factorial =%d",f);
}

Operator

#include<stdio.h>
void operator(char op)
{
switch(op)
{

case '<':
case '>':
    printf("\n\t Relational operator");
    break;
case '+':
case '*':
case '/':
case '%':
case '-':
    printf("\n\t Arithmetic Operator ");
    break;
case '!':
    printf("\n\tLogical Operator");
    break;
case '&':
case '~':
case '^':
case '|':
    printf("\n\tBitwise Operator");
    break;
case '=':
    printf("\n\tAssignment operator ");
    break;
default:
    printf("\nInvalid Operator");
}
}
void main()
{
    char c;
    printf("\n Enter the operator :");
    scanf("%c",&c);
    operator(c);
}

Armstrong number

#include<stdio.h>
int  arm(n)
{
    int temp,sum=0;
     while(n!=0)
        {
            temp=n%10;
            n=n/10;
            temp=temp*temp*temp;
            sum+=temp;
        }
        return sum;
}
void main()
{
    int num,f,low,up,armstrong=0;
    printf("Enter the lower limit");
    scanf("%d",&low);
    printf("Enter the upper limit");
    scanf("%d",&up);
    for(num=low;num<=up;num++)
    {
    f=arm(num);
    if(num==f)
    {
        printf("\nArmstrong number =%d",f);
        armstrong=1;
    }
    else if(num==up&&armstrong==0)
        printf("\nNo Armstrong Number in this range");
    }
}

Arithmetic Calculator

#include<stdio.h>
int add(int a,int b)
{
    return(a+b);
}
int sub(int a,int b)
{
    return(a-b);
}
int mul(int a,int b)
{
    return(a*b);
}
int div(int a,int b)
{
    return(a/b);
}
int mod(int a,int b)
{
    return(a%b);
}

void main()
{
int a,b,ch;
char con;
do
{
    printf("\t Arithmetic Operations");
    printf("\n\t1-Addition\n\t2-Subtraction");
    printf("\n\t3-Multiplication\n\t4-Division\n\t5-modulus");
    printf("\n Enter your choice :");
    scanf("%d",&ch);
    printf("\nEnter the First number:");
    scanf("%d",&a);
    printf("\nEnter the Second Number:");
    scanf("%d",&b);
    switch(ch)
    {

    case 1:
        printf("\nAddition =%d",add(a,b));
        break;
    case 2:
        printf("\n\t Subtraction=%d",sub(a,b));
        break;
    case 3:
        printf("\n\tMultiplication=%d",mul(a,b));
        break;
    case 4:
        printf("\n\tDivision=%d",div(a,b));
        break;
    case 5:
        printf("\n\tModulus=%d",mod(a,b));
        break;
    default:
        printf("\nInvalid Option");
    }
    printf("\nPress Y to continue:");
    scanf("%s",&con);
}while(con=='Y'||con=='y');
}

Find the Largest Number Among Three Numbers


#include<stdio.h>
void findbig(int num1,int num2,int num3);
void main()
{
    int num1,num2,num3;
    printf("Largest of three numbers:");
    printf("\nEnter the numbers one by one");
    scanf("%d",&num1);
    scanf("%d",&num2);
    scanf("%d",&num3);
    findbig(num1,num2,num3);
}
void findbig(int num1,int num2,int num3)
{
    if(num1>num2&&num1>num3)
        printf("\n%d is the largest among %d, %d and %d",num1,num1,num2,num3);
    else if(num2>num1&&num2>num3)
        printf("\n%d is the largest among %d, %d and %d",num2,num1,num2,num3);
    else
        printf("\n%d is the largest among %d, %d and %d",num3,num1,num2,num3);
}

Find Employee Gross salary

#include<stdio.h>
double salary(float basic);
void main()
{
    float basic,gross;
    printf("What is your basic pay?");
    scanf("%f",&basic);
    gross=salary(basic);
    printf("\n your Gross Salary is %f",gross);
    printf("\nThank you!!");
}
double salary(float basic)
{
    float ta,da;
    ta=(12*basic)/100;
    da=(10*basic)/100;
    return(basic+ta+da);
}

Calculate Revenue

 Prompt the user for Price ( floating point number) and  Quantity (integer). Determine total revenue using the following formula: Total Revenue = Price * Quantity


#include<stdio.h>
void rev(float price,int quant);
void main()
{
    int q;
    float p;
    printf("Price=");
    scanf("%f",&p);
    printf("Quantity=");
    scanf("%d",&q);
    rev(p,q);
}
void rev(float price,int quant)
{
    float total=price*quant;
    printf("\nTotal revenue:%f",total);
}

Operation on Matrix

 Perform Following operations on matrices
 1. Addition of two matrices
 2. Subtraction of two matrices
 3. Multiplication of two matrices
 4. Row sum
 5. Column sum
 6. Diagonal sum



#include<stdio.h>
void main()
{
int i,j,k,m1,m2,n1,n2,a[10][10],b[10][10],c[10][10],ch,sum[10],dsum=0;
do
    {
        printf("\nOperation On matrices");
        printf("\n*********************");
        printf("\n1.Matrix Addition");
        printf("\n2.Matrix Subtraction");
        printf("\n3.Matrix Multiplication");
        printf("\n4.Row Sum");
        printf("\n5.Column Sum");
        printf("\n6.Diagonal Sum");
        printf("\n7.Exit");
        printf("\nEnter your Choice");
        scanf("%d",&ch);
        switch(ch)
        {
        case 1:
        case 2:
        case 3:
               {
                printf("Enter the row and column  of Matrix A\n");
                scanf("%d %d",&m1,&n1);
                printf("Enter the row and column of Matrix B\n");
                scanf("%d%d",&m2,&n2);
                if(m1==m2&& n1==n2);
                else if(m1==n2);
                else
                {
                    printf("\n Arithmetic operation not possible, Rows and Columns are not Equal");
                    break;
                }
                    printf("Enter the Matrix A\n");
                    for(i=0;i<m1;i++)
                    {
                        for(j=0;j<n1;j++)
                            scanf("%d",&a[i][j]);
                    }


                    printf("\nEnter the Matrix B\n");
                    for(i=0;i<m2;i++)
                    {
                        for(j=0;j<n2;j++)
                            scanf("%d",&b[i][j]);
                    }
                    switch(ch)
                    {
                    case 1:
                            for(i=0;i<m1;i++)
                                for(j=0;j<n2;j++)
                                    c[i][j]=a[i][j]+b[i][j];
                                    break;
                    case 2:
                            for(i=0;i<m1;i++)
                                for(j=0;j<n2;j++)
                                    c[i][j]=a[i][j]-b[i][j];
                                    break;
                    case 3:
                            for(i=0;i<m1;i++)
                                for(j=0;j<n2;j++)
                                {
                                    c[i][j]=0;
                                    for(k=0;k<m2;k++)
                                        c[i][j]=c[i][j]+a[i][k]*b[k][j];
                                }

                    }
                    if(ch==1)
                    printf("\n Addition  of Matrix \n");
                    else if(ch==2)
                        printf("\nSubtraction of matrix\n");
                    else
                        printf("\nMultiplication of Matrix\n");
                        for(i=0;i<m1;i++)
                            {
                            for(j=0;j<n2;j++)
                                printf("%d\t",c[i][j]);
                            printf("\n");
                            }
                break;
                }
                    case 4:
                        printf("Enter the Row and column\n");
                        scanf("%d %d",&m1,&n1);
                        printf("Enter the Matrix \n");
                            for(i=0;i<m1;i++)
                            {
                                sum[i]=0;
                                for(j=0;j<n1;j++)
                                {
                                    scanf("%d",&a[i][j]);
                                    sum[i]+=a[i][j];
                                }
                            }
                            for(j=0;j<m1;j++)
                                printf("\n%d  row sum:%d",j+1,sum[j]);
                         break;
                    case 5:
                        printf("Enter the Row and column\n");
                        scanf("%d %d",&m1,&n1);
                        printf("Enter the Matrix \n");
                            for(i=0;i<m1;i++)
                                for(j=0;j<n1;j++)
                                    scanf("%d",&a[i][j]);
                            for(i=0;i<m1;i++)
                            {
                                sum[i]=0;
                                for(j=0;j<n1;j++)
                                    sum[i]+=a[j][i];
                            }
                            for(j=0;j<m1;j++)
                                    printf("\n%d  row sum:%d",j,sum[j]);
                        break;
                    case 6:
                        printf("Enter the Row and column\n");
                        scanf("%d %d",&m1,&n1);
                        printf("Enter the Matrix \n");
                            for(i=0;i<m1;i++)
                            {
                                for(j=0;j<n1;j++)
                                {
                                    scanf("%d",&a[i][j]);
                                    if(i==j)
                                      dsum+=a[i][j];
                                }
                            }
                            printf("\nSum of Diagonal:%d",dsum);
                            break;
                    case 7:
                        exit(0);
                        break;
                    default:
                        printf("\nWrong Choice....Try again...");
                }
        }while(ch!=7);

}