Beruflich Dokumente
Kultur Dokumente
UNIT-I
1. Define System Software.
System Software is a collection of a System programs that perform a variety of
functions, viz file editing, resource accounting, I/O management etc.
i. A-ACCUMULATOR
ii. X-INDEX REGISTER
iii. L-LINKAGE REGISTER
iv. PC-PROGRAM COUNTER
v. SW-STATUS WORD
4. What is instruction set?
Instruction set provides the information about the types of instructions given in
the particular architecture. Instruction set differs from architecture to architecture.
14.What is an Assembler?
An assembler is a computer program for translating assembly language —
essentially, a mnemonic representation of machine language — into object code.
15.What ia an assembler Directive?
Statement of this kind neither represent machine instructions to be included in the
object program nor indicate the allocation of storage for constants or program
variables.Instead,these statements direct the assembler to take certain action during
the process of assembling a program.
16.What are the functions of an assembler?
Converts mnemonics operation codes to their machines language equivalents.
Converts symbolic operands to their equivalent machine addresses.
Builds the machine instructions in the proper format.
Converts the data constant specified in the source program into their internal machine
representations.
Writes the object program and assembly listing.
17.What is OPTAB?
OPTAB stands for Operation Code Table.OPTAB is data structure used to look up
mnemonic codes and translate them to their machine language equivalents.
18.What is SYMTAB?
Symbol Table is a data structure to hold the symbols encountered during pass-1 and
their values.
19.What is Location Counter (LOCCTR)?
Location Counter is a variable that is used to help in the assignment of addresses.
LOCCTR is initialized to the beginning address specified in the START statement.
20.Define “Literal Pools”.
All of the literal operands used in a program are gathered into one or more literal pools.
Normally literals are placed into at the end of the program.
21.What is Load-and –Go assembler?
The Load-and –Go assemble is a one-pass assembler that generates the object code in
memory for execution. No object program is written out and no loader is needed.
22.What are the two assembler directives used to identify external reference?
Symbols that are defined in one control section may not be used directly by another
control section, they must be identified as external references for the loader to handle.
To identify such references EXTDEF and EXTDEF assembler directives are used.
In most cases all the program translators on a particular system produce object
programs in the same format.
“Relocation Bit” often solves the problem of relocation. The assembler associates a
bit with each instruction or address field. If this bit equals one, then the address field
must be relocated, otherwise the field is not relocated.
36.What are the three main data structures used by our macro-processor?
Data Structures -- Global Variables
DEFTAB
NAMTAB
ARGTAB
#include<stdio.h>
#include<conio.h>
#include<string.h>
#include<process.h>
#include<graphics.h>
#include<dos.h>
struct emp
{
char rno[10];
char tname[10];
char from[10];
char to[10];
int st;
}a;
struct emp1
{
char rno[10];
char tdate[8];
int st;
}b;
FILE *fp1,*fp2,*fp3;
char fname[20],fname1[20];
void add();
void edit();
void disp();
void dele();
void res();
void grap();
void main()
{
int ch=0,r1;
grap();
while(ch!=6)
{
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
dele();
break;
case 3:
edit();
break;
case 4:
disp();
break;
case 5:
res();
break;
case 6:
exit(0);
}
}
}
void add()
{
char yesno='y';
clrscr();
fp1=fopen("rwl.dat","a");
// printf("ADD FILES");
while(yesno=='y'||yesno=='y')
{
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
Enter the train Number :");
scanf("%s",a.rno);
printf("
Enter the Train name :");
scanf("%s",a.tname);
printf("
Enter the Arrival station :");
scanf("%s",a.from);
printf("
Enter the Departure station :");
scanf("%s",a.to);
printf("
Enter the Total Seats : ");
scanf("%d",&a.st);
fprintf(fp1,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,a.st);
printf("
do u want to continue[y/n]");
yesno=getchar();
fflush(stdin);
}
fclose(fp1);
}
void edit()
{
char empno1[4];
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
Enter the train Number to edit :");
scanf("%s",empno1);
fp1=fopen("rwl.dat","r");
fp2=fopen("trwl.dat","w");
strcpy(fname,"rwl.dat");
strcpy(fname1,"trwl.dat");
while(!feof(fp1))
{
fscanf(fp1,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,&a.st);
// printf(" %s ",a.rno);
if(strcmp(a.rno,empno1)==0)
{
printf("
Enter the train Number :");
scanf("%s",a.rno);
printf("
Enter the Train Name :");
scanf("%s",a.tname);
printf("
Enter the Arrival station :");
scanf("%s",a.from);
printf("
Enter the Departure station :");
scanf("%s",a.to);
printf("
Enter the Total Seats :");
scanf("%d",&a.st);
fprintf(fp2,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,a.st);
// break;
}
else
fprintf(fp2,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,a.st);
}
fclose(fp1);
fclose(fp2);
unlink(fname);
rename(fname1,fname);
void disp()
{
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^
");
printf(" TRAIN-NO NAME DEP ARR SEATS
");
printf(" -------- ---- ---- ----- ------
");
fp1=fopen("rwl.dat","r");
while(!feof(fp1))
{
fscanf(fp1,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,&a.st);
printf(" %s %s %s %s %d
",a.rno,a.tname,a.from,a.to,a.st);
}
fclose(fp1);
getch();
}
void dele()
{
char empno1[4];int i=0;
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
Enter the train Number to delete :");
scanf("%s",empno1);
fp1=fopen("rwl.dat","r");
fp2=fopen("trwl.dat","w");
strcpy(fname,"rwl.dat");
strcpy(fname1,"trwl.dat");
while(!feof(fp1))
{
fscanf(fp1,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,&a.st);
if(strcmp(a.rno,empno1)!=0)
{
fprintf(fp2,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,a.st);
}
else
{ i=1;
printf("
TRAIN DETAILS DELETED SUCCESSFULLY ");
}
}
if(i==0)
{
printf("
SORRY -> INVALID TRAIN NUMBER ");
}
fclose(fp1);
fclose(fp2);
unlink(fname);
rename(fname1,fname);
getch();
void res()
{
char empno1[4],tdate[8];
int i=0,n;
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
Enter the train Number :");
scanf("%s",empno1);
printf("
Enter the Date :");
scanf("%s",tdate);
{
fp1=fopen("res.dat","r");
fp2=fopen("trwl.dat","w");
strcpy(fname,"res.dat");
strcpy(fname1,"trwl.dat");
while(!feof(fp1))
{
fscanf(fp1,"%s %s %d
",b.rno,b.tdate,&b.st);
if((strcmp(b.rno,empno1)==0) && (strcmp(b.tdate,tdate)==0))
{
i=1;
printf("
Total seats Available : ");
printf("%d",b.st);
printf("
Enter the Number of Seats:");
scanf("%d",&n);
if(n > b.st)
{
printf("
SORRY,LIMIT EXCEEDED ");
}
else
{ b.st=b.st-n;
printf("
TICKETS BOOKED SUCCESSFULLY ");
}
fprintf(fp2,"%s %s %d
",b.rno,b.tdate,b.st);
}
else
{
fprintf(fp2,"%s %s %d
",b.rno,b.tdate,b.st);
}
}
rewind(fp1);
fclose(fp1);
fclose(fp2);
// printf(" %d ",i);
// getch();
if (i==1)
{
getch();
unlink(fname);
rename(fname1,fname);
}
if (i==0)
{
fp1=fopen("rwl.dat","r");
while(!feof(fp1))
{
fscanf(fp1,"%s %s %s %s %d
",a.rno,a.tname,a.from,a.to,&a.st);
// printf("%s",a.rno);
if(strcmp(a.rno,empno1)==0)
{ i= 2;
n=a.st;
}
}
fclose(fp1);
if (i==2)
{
fp1=fopen("res.dat","a");
{
/* printf("
Enter the train Number -> ");
scanf("%s",b.rno);
printf("
Enter the Date -> ");
scanf("%s",b.tdate); */
strcpy(b.rno,empno1);
strcpy(b.tdate,tdate);
printf("
Total Seats Available : %d ",n);
printf("
Enter Number of seats : ");
scanf("%d",&b.st);
if( n < b.st)
{
printf("
SORRY,LIMIT EXCEEDED ");
b.st=n;
}
else
{b.st=n-b.st;
printf("
TICKETS BOOKED SUCCESSFULLY ");
}
fprintf(fp1,"%s %s %d
",b.rno,b.tdate,b.st);
//fflush(stdin);
}
rewind(fp1);
fclose(fp1);
getch();
}
else
{
clrscr();
printf("
SOUTHERN RAILWAYS");
printf("
^^^^^^^^^^^^^^^^^");
printf("
Enter the Valid Train Number ");
getch();
}
}
}
void grap()
{
int gdriver = EGA, gmode = EGAHI;
int bkcol, maxcolor, x, y,i;
char msg[80];
//' settextstyle(3,0,12);
// outtextxy(200,20,"RMD");
for (i=1;i<=70;i++)
{
setcolor(7);
circle(i,20+i,i);
circle(i,220-i,i);
circle(620-i,220-i,i);
circle(620-i,20+i,i);
delay(100);
settextstyle(3,0,12);
outtextxy(200,20,"RMD");
settextstyle(3,0,4);
outtextxy(155,160,"ENGINEERNG COLLEGE");
delay(3000);
for (i=1;i<=90;i++)
{
setcolor(1);
line(155,60+i,470,60+i);
line(155,200-i,470,200-i);
delay(20);
setcolor(0);
line(155,60+i,470,60+i);
line(155,200-i,470,200-i);
}
for (i=1;i<=270;i++)
{
setcolor(1);
line(312-i,10,312-i,250);
line(309+i,10,309+i,250);
delay(10);
setcolor(0);
line(312-i,10,312-i,250);
line(309+i,10,309+i,250);
}
setcolor(15);
settextstyle(3,0,4);
outtextxy(200,100,"WELCOME TO");
settextstyle(3,0,4);
outtextxy(90,150,"RAILWAY TICKET RESERVATION");
delay(1000);
getch();
closegraph();
}
BLINKING STRARS
#include<conio.h>
#include<graphics.h>
#include<stdlib.h>
#include<dos.h>
void main()
{
int gdriver=DETECT,gmode;
int i,x,y;
initgraph(&gdriver,&gmode,"e: cgi");
Mnemonic Number Special use
while(!kbhit())
B Base register; used for addressing
3
{ S 4 General working register
T 5 General working register
x=random(640);
F 6 Floating-point acumulator (48bits)
y=random(480);
setcolor(15);
for(i=1;i<10;i++)
{
circle(x,y,i);
delay(10);
}
setfillstyle(1,15);
line(x+8,y-2,x+40,y);
line(x+8,y+2,x+40,y);
floodfill(x+11,y,15);
line(x-8,y-2,x-40,y);
line(x-8,y+2,x-40,y);
floodfill(x-11,y,15);
line(x-2,y+8,x,y+40);
line(x+2,y+8,x,y+40);
floodfill(x,y+11,15);
line(x-2,y-8,x,y-40);
line(x+2,y-8,x,y-40);
floodfill(x,y-11,15);
line(x+8,y-2,x+20,y-20);
line(x+2,y-8,x+20,y-20);
floodfill(x+15,y-15,15);
line(x+8,y+2,x+20,y+20);
line(x+2,y+8,x+20,y+20);
floodfill(x+15,y+15,15);
line(x-8,y+2,x-20,y+20);
line(x-2,y+8,x-20,y+20);
floodfill(x-15,y+15,15);
line(x-8,y-2,x-20,y-20);
line(x-2,y-8,x-20,y-20);
floodfill(x-15,y-15,15);
sound(4000);
setcolor(0);
for(i=40;i>=10;i--)
{
line(x+8,y-2,x+i,y);
line(x+8,y+2,x+i,y);
}
for(i=40;i>=10;i--)
{
line(x-8,y-2,x-i,y);
line(x-8,y+2,x-i,y);
}
for(i=40;i>=10;i--)
{
line(x-2,y+8,x,y+i);
line(x+2,y+8,x,y+i);
}
for(i=40;i>=10;i--)
{
line(x-2,y-8,x,y-i);
line(x+2,y-8,x,y-i);
}
for(i=20;i>=7;i--)
{
line(x+8,y-2,x+i,y-i);
line(x+2,y-8,x+i,y-i);
}
for(i=20;i>=7;i--)
{
line(x+8,y+2,x+i,y+i);
line(x+2,y+8,x+i,y+i);
}
for(i=20;i>=7;i--)
{
line(x-8,y+2,x-i,y+i);
line(x-2,y+8,x-i,y+i);
}
for(i=20;i>=7;i--)
{
line(x-8,y-2,x-i,y-i);
line(x-2,y-8,x-i,y-i);
}
for(i=9;i>0;i--)
{
circle(x,y,i);
delay(10);
}
nosound();
}
cleardevice();
setcolor(2);
settextstyle(2,0,1);
outtextxy(220,160,"Creator:Shasankar Paul");
outtextxy(265,235,"Bsc Ist Year");
outtextxy(210,335,"Email:shash1986@dataone.in");
getch();getch();
}
main()
{
int num, cnt = 0;
while (num != 0)
{
num = num & (num - 1);
cnt++;
}
printf("
number of parity bits = %d ",cnt);
}