100% found this document useful (1 vote)
5K views35 pages

12th Computer Science Practical Question Papers 1&2

The document contains instructions and student responses for 4 programming experiments conducted as part of a practical examination on computer science: 1. The first experiment involves writing a C++ program to swap two numbers using call by value and call by reference methods. The student successfully completes both parts. 2. The second experiment is a linear search algorithm to find a given integer in a 10-element array. The student defines the array, searches successfully, and prints the output. 3. The third experiment implements a binary search on a sorted array of 10 integers to find a given target number. The student completes the task and outputs the results. 4. Instructions and blank space is provided for a fourth experiment on sorting algorithms

Uploaded by

Namdev Shelar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
5K views35 pages

12th Computer Science Practical Question Papers 1&2

The document contains instructions and student responses for 4 programming experiments conducted as part of a practical examination on computer science: 1. The first experiment involves writing a C++ program to swap two numbers using call by value and call by reference methods. The student successfully completes both parts. 2. The second experiment is a linear search algorithm to find a given integer in a 10-element array. The student defines the array, searches successfully, and prints the output. 3. The third experiment implements a binary search on a sorted array of 10 integers to find a given target number. The student completes the task and outputs the results. 4. Instructions and blank space is provided for a fourth experiment on sorting algorithms

Uploaded by

Namdev Shelar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 35

MAHARASHTRA STATE BOARD OF SECONDARY AND

HIGHER SECONDARY EDUCATION – PUNE


Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 1

A) Write a program in C++ that exchange data (Call by Value) using SWAP function
i.e. void swap( int, int)to interchange the given two numbers. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. The output must list the
given numbers before as well as after swapping. 05

// call by value
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int a,b;
void swap(int,int);
cout<<"enter the value of two numbers:";
cin>>a>>b;

cout<<"before swapping A="<<a<<"b="<<b<<endl;


swap( a, b);
cout<<"after swapping A="<<a<<"b="<<b<<endl;
getch();
}
void swap(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
}

enter the value of two numbers:55


66
before swapping A=55b=66
after swapping A=55 b=66
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 2

A) Write a program in C++ that exchange data (Call by Reference) using SWAP
function void swap( int *, int *)to interchange the given two numbers. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. The output must list the
given numbers before as well as after swapping. 05

//Program to Demonstrate call by reference//


#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int a,b;
void swap(int*x,int*y);
cout<<"enter the value of two numbers:";
cin>>a>>b;

cout<<"before A="<<a<<"b="<<b<<endl;
swap(& a,& b);
cout<<"after A="<<a<<"b="<<b<<endl;
getch();
}
void swap(int*x,int*y)
{
int temp;
temp=*x;
*x=*y;
*y=temp;
}
enter the value of two numbers:55
66
before A=55b=66
after A=66b=55
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 3

A) Write a program in C++, that first initializes an array of given 10 integer numbers.
The program must verify whether a given element belongs this array or not, using
LINEAR SEARCH technique. The element (to be search) is to be entered at the
time of execution. If the number is found, the program should print” The Number is
Found” otherwise it should print “The number is not Found”. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//LINEAR SEARCH//
#include<iostream.h>
#include<conio.h>
void main ()
{
clrscr();
int num[10],n;
cout<<"enter the 10 numbers for the array."<<endl;
for(int i=0;i<10;i++)
cin>>num[i];
cout<<"enter the number for linear search:";
cin>>n;
for(i=0;i<=10;i++)
{
if(num[i]==n)
{
cout<<"the number is present search successful at position"<<i+1<<endl;
break;
}
}
if (i==10)
cout<<"the number is absent search unsuccessful"<<endl;
getch();

enter the 10 numbers for the array.


1
2
3
4
5
6
78
8
9
10
enter the number for linear search:78
the number is present search successful at position7
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 4

A) Write a program in C++, that first initializes an array of given 10 sortedinteger


numbers. The program must verify whether a given element belongs this array or
not, using BINARY SEARCH technique. The element (to be search) is to be
entered at the time of execution. If the number is found, the program should print”
The Number is Found” otherwise it should print “The number is not Found”. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//Binary search//
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a[10],n,i,x,beg,end,mid;
cout<<"enter number of array elements"<<endl;
cin>>n;
beg=0;
end=n-1;
mid=(beg+end)/2;
cout<<"enter the elements"<<endl;
for(i=0;i<n;i++)
cin>>a[i];
cout<<"enter element to be search";
cin>>x;
while(a[mid]!=x&&beg<=end)
{
if(a[mid]>x)
end=mid-1;

beg=mid+1;
mid=(beg+end)/2;
}
if(a[mid]==x)
cout<<"element is present at position"<<mid+1;
else
cout<<"search unsuccessfull";
getch();
}

enter number of array elements


5
enter the elements
10 20 30 40 50
enter element to be search 30
element is present at position3
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No. 01.____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 5

A) Write a program in C++, that first initializes an array of given 10 integer numbers.
The program must sort numbers in Ascending/Descending order using BUBBLE
SORT method. It should print the given list of numbers as well as the sorted list. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//Bubble sort//
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int i,j,t,sort[10];
cout<<"enter the array element";
for(i=0; i<10;i++)
{
cin>>sort[i];
}
for(i=0;i<10;i++)
{
for(j=10;j>0;j--)
{
if(sort[j-1]>sort[j])
{
t=sort[j-1];
sort[j-1]=sort[j];
sort[j]=t;
}
}
}
cout<<"sorted array is-"<<endl;
for(i=0;i<10;i++)
{
cout<<sort[i]<<endl;
}
getch();
}
enter the array element10
2 5 3 8 25 14 57 25 147 10
sorted array is-
2
3
5
8
10
14
25
25
57
147
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No. 01.____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 6

A) Write a program in C++, that first initializes an array of given 5 integer numbers.
The program should perform summation of array elements using POINTER. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output 05

//sum of array
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int num[5],i,*p,sum=0;
cout<<"enter array elements:=\n";
for(i=0;i<5;i++)
cin>>num[i];
p=num;
for(i=100;i<105;i++,p++)
{
sum=sum+*p;
}
cout<<"the sum of array is "<<sum;
getch();
}

enter array elements:=


2
3
1
4
5
the sum of array is 15
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 7

A) Write a program in C++,using OOP to create theclass fib with CONSTRUCTOR


AND DE-CONSTRUCTOR and one member function voidgenfib().The program
must print the message “OBJECT IS BORN” when the OBJECT is create i.e. Class
Fib F. The program must display “OBJECTSARE DESTROYED….” when the class
de- constructor is called for the object when it reaches the end of its scope. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//Constructor and destructor//


#include<iostream.h>
#include<conio.h>
class fib
{
private:
int f1,f2,f3;//data members
public:
fib();//constructor member function
~fib()//destructor member function
{
cout<<"object are destroyed....";
}
void genfib();
};
//memberfunctions are define outside the class
fib::fib()
{
f1=0;
f2=1;
f3=0;
cout<<f1<<endl<<f2<<endl;
cout<<"object is born"<<endl;
}
void fib ::genfib()
{
cout<<"object is alive"<<endl;
while(f3<55)
{
f3=f1+f2;
cout<<f3<<endl;
f1=f2;
f2=f3;
}
}
void main()
{
clrscr();
class fib f;//create object and call constructor when object f is born
f.genfib();
getch();
}//destructor will be called here
0
1
object is born
object is alive
1
2
3
5
8
13
21
34
55
object are destroyed....
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 8

A) Write a program in C++, using OOP to demonstrating the implementation of


SINGLE INHERITANCE, having two class viz. student and result. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//Demonstrating inheritance//
#include<iostream.h>
#include<conio.h>

class student
{
private:
float rollno;
public:
float p,c,m,b,e;
void getdata()
{
cout<<"enter the marks of 5 subjects:-";
cin>>p>>c>>m>>b>>e;
}

};

class result : public student


{
private:
float total,per;
public:
void disdata();
};

void result::disdata()
{
getdata();
total=p+c+m+b+e;
per=total/500*100;
cout<<"total::"<<total<<"percentage::"<<per;
}
void main()
{
clrscr();
class result zl;
zl.disdata();
getch();
}
enter the marks of 5 subjects:-
95
96
94
93
92
total::470
percentage::94
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 9

A) Write a program in C++, using OOP to demonstrating the implementation of


FRIEND, having two class viz. XYX and ABC. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//friend function
#include<iostream.h>
#include<conio.h>
class abc;//forward declaration
class xyz
{
private:
int x;
public:
void setvalue(int i)
{
x=i;
}
friend void max(xyz,abc);
};

class abc
{
private:
int a;
public:
void setvalue(int i)
{
a=i;
}
friend void max(xyz,abc);
};

void max(xyz m,abc n)


{
if(m.x>n.a)
cout<<"greatest number is"<<m.x<<endl;
else
cout<<"greatest number is"<<n.a<<endl;
}
void main()
{
clrscr();
xyz T1;
T1.setvalue(10);
abc T2;
T2.setvalue(20);
max(T1,T2);
getch();
}

greatest number is 20
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 10

A) Write a program in C++, using OOP to demonstrating the implementation of


FUNCTION OVERLOADING having two classes. 15
B) Enter the program and verify proper execution of the same on the computer. 10
C) Obtain a hardcopy of the program listing as well as output. 05

//functional overloading//
#include<iostream.h>
#include<conio.h>
class ex
{
public:
void calc(int x,int y);
void calc(float a,float b);
};
void ex::calc(int x,int y)
{
int total;
total=x+y;
cout<<"\ntotal="<<total;
}
void ex::calc(float a,float b)
{
float sub;
sub=a-b;
cout<<"\nsub="<<sub;
}
void main()
{
ex ob;
clrscr();
int x,y;
float a,b;
cout<<"enter the value for x and y";
cin>>x>>y;
cout<<"enter the value for a and b";
cin>>a>>b;
ob.calc(a,b);
getch();
}

enter the value for x and y


12
10
enter the value for a and b
14
10
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

D) Write a program in HTML, to create college profile. 15


E) Enter the program and verify proper execution of the same on the computer. 10
F) Obtain a hardcopy of the program listing as well as output. 05

Page1.html : Page1.html :
<HTML> <HTML>
<HEAD> <TITLE> THIS IS SECOND PAGE</TITLE>
<TITLE>PROGRAM NO.10</TITLE> <bodybgcolor="YELLOW">
</HEAD> <B>Vision and mission</B>
<BODY BGCOLOR="YELLOW"TEXT="GREEN"> <P>To Become one of the best education in the country
<H1 ALIGN="CENTER">B.G.E SOCIETY</H1> aspiring for national recognition of excillience through
<H2 ALIGN="CENTER">Universal College of teachinglearning research and extension in the field of
Science</H2> science and technology.</P>
<HR>
<CENTER>VISIT TO <A <TABLE>
HERF="http://www.unicollege.com" <CAPTION>DEPARTMENT OF COMPUTER
>R.L.T COLLEGE</A></CENTER> SCIENCE</CAPTION>
<HR> <TR>
<H4 ALIGN="CENTER">CIVIL LINE ROAD, NEAR <TH>SR NO.</TH>
ARTS COLLEGE AKOLA <TH>TEACHING AND NON TEACHING
<BR>PIN CODE=444001<BR>INDIA STAFF</TH>
(MAHARASHTRA)</H4> <TH>QUALIFICATION</TH>
<H3 ALIGN="LEFT">COURSES AVAILABLE</H3> <TH>DESIGNAITION</TH>
<UL> <TH>COLLEGE</TH></TR>
<LI>COMPUTER SCIENCE <TR>
<LI>ELECTRONICS <TD>1</TD>
<LI>F.W.F.C <TD>MR. R G CHAVAN</TD>
<LI>I.T <TD>MSc.(Electronic)</TD>
<LI>GENERAL SCIENCE <TD>H.O.D Incharge</TD>
</UL> <TD>Sr. College</TD></TR>
</UL> <TR><TD>2</TD>
<H3 ALIGN="LEFT">FACILITIES</H2> <TD>MRS R.S CHANDAK</TD>
<UL> <TD> MSc.(COMPUTER SCIENCE)</TD>
<LI>QUALIFIED STAFF <TD>LECT. OR FIX PAY</TD>
<LI>WELL MAINTAINED COMPUTER LAB <TD> Sr.College</TD></TR>
<LI>CHEMISTRY LAB <TR>
<LI>PHYSICS LAB <TD>3</TD>
<LI>WELL EQUIPIED CANTEEN <TD>MRS. V M VIBHUTE</TD>
<LI>WELL DEVELOPED LIBRARY <TD>MSc.(COMP SCI)</TD>
<LI>AUDITORIUM FOR SPECIAL PROGRAM <TD> CHB</TD>
<LI>BEST TEACHER STAFF <TD>Sr.College</TD></TR>
<LI>BEST RESULT IN MAHARASHTRA <TR>
<LI>BOXING RING <TD>4</TD>
<LI>BOTINICAL GARDEN <TD>MRS M.D.KHETAN</TD>
<LI>RESEARCH LAB <TD>MSc.(INF.TEC)</TD>
<LI>COMPUTER LAB <TD>CHB</TD>
<LI>WIFI CAMPUS <TD>Sr.College</TD></TR>
</OL> </TABLE>
<LI> </BODY>
<A HREF=file:C:\Documents and Settings\Dell </HTML>
3\Desktop/college1.html
CLICK HERE</A>
</BODY>
</HTML>
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science - D93 (Paper – I)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 12

G) Write a program in HTML, to create college profile. 15


H) Enter the program and verify proper execution of the same on the computer. 10
I) Obtain a hardcopy of the program listing as well as output. 05

Page1.html : Page1.html :
<HTML><HEAD>
<TITLE>TOURITS LEAFLET</TITLE></HEAD><BODY <html>
BG COLOR="ORANGE"> <head>
<B><CENTER><BIG>PRAKASH <title>Maharashtra State</title>
TOURISM<BR>TOURIST LEAFLET FOR </head>
AURANGABAD </BIG></CENTER></B> <body bgcolor="aqua" text="red" link="black">
<OL?<LI>MODES OF TRANSPORT</LI><UL> <center><b>Welcome to official website
<LI>BY ROAD-ABOUT 350KM FROM MUMBAI .ONE of<br><u>Maharashtra</u></b></center>
CAN USE TAXIESOR <center><b>Maharashtra State</b></center>
BUSES TO REACH</LI> <p>Maharashtra is the state in the western region of
<LI>BY RAIL-MANY TRAINS ARE AVAILABLE FROM India. Literally the word Maharashtra is derived
MUMBAI TO A'BAD</LI> from
<LI>BY AIR-MANY TYPES OF FLIGHTS ARE the sanskrit words i.e. Maha means "The Great" and
AVAILABLE AT VARIOUS Rashtra means "Nation".Thus the meaning of
TIMINIGS</LI></UL><LI>ACCOMODATION</LI><UL> Maharashtra is
<LI>BEING A BIG CITY THERE ARE ALL TYPES OF "The Great Nation".Munbai is the capital of the
HOTELS AVAILABLE FOR ALL TYPESOF state. Marathi is the mother tounge of this state,who
POCKETS</LI></UL> are knows as Marathas or Maharashtrians.</p>
<LI>MAJOR ATTRACTION</LI><UL> <h1 align left>General info. of Maharashtra</h1>
<LI>AURANGABAD IS A HISTORICAL CITY THUS <ol type="1">
MANY PLACES HERE ARE OF <li>Country: India
HISTORICAL IMPORTANCE</LI> <li>State: Maharashtra
<LI>FORT OF DAULATABAD</LI> <li>Established: 1 May 1960 (Maharashtra Day)
<LI>AJANTA & ELLORA CAVES</LI> <li>Location: Western region of India
<LI>BIBI KA MAUBARA</LI></UL> <li>Capital: Mumbai
<LI>SPECIAL ATTRACTION<LI><UL> <li>Capital of tourism: Aurangabad
<LI>MANY PEOPLE FROM WHOLE WORLD COME <li>Time to visit: Sep to Apr(Cost), Jun to Sep(Hill
HERE TO SEE THE ANCIENT stations)
CAVES OF AJANTA & ELLORA</LI> <li>Language: Marathi, Hindi, English,Urdu
<LI>THE BIBI KA MQUBARA IS AN ALMOST <li>Population: 11,23,72,972
REPLICA OF THE MAGNIFICENT <li>Area: 3,07,713 km.sq.
MOGHUL ARTIFACT THE TAJ <li>Area rank: Third
MAHAL</LI></UL></OL><PRE> <li>Literacy: 82.9%
WE WOULD ALL OF YOU TO COME HERE TO VISIT <li>Industrial output: 15%
THE BEAUTIFUL AND ANCIENT <li>Forest area: 17% of total area of state
AND <BR>HISTORICAL IMPORTANT CITY <li>Crops; Cotton, Soya, Wheat, Rice, Oilseads
AURANGABAD AND GET LOST IN ITS <li>Rivers: Krishna, Godavari, Purna
BEAUTY</PRE></BODY></HTML> <li>Official language: Marathi
<li>Website: www.maharashtra.gov.in
</ol>
</body>
</html>
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 1

A) Write an A.L. Program that performs ADDITION of two 1- bytes hexadecimal


numbers stored at ______ and __________.Store the results immediately after the
end of the block. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 1

D) Write an A.L. Program that performs ADDITION of two 1- bytes hexadecimal


numbers stored at ______ and __________. Store the results immediately after the
end of the block. 20
E) Enter the program on the microprocessor kit. 05
F) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 1

G) Write an A.L. Program that performs ADDITION of two 1- bytes hexadecimal


numbers stored at ______ and __________. Store the results immediately after the
end of the block. 20
H) Enter the program on the microprocessor kit. 05
I) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 2

A) Write an A.L. Program that performs SUBTRACTION of two 1- bytes


hexadecimal numbers stored at ______ and __________. Store the results
immediately after the end of the block. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 2

D) Write an A.L. Program that performs SUBTRACTION of two 1- bytes


hexadecimal numbers stored at ______ and __________. Store the results
immediately after the end of the block. 20
E) Enter the program on the microprocessor kit. 05
F) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 2

G) Write an A.L. Program that performs SUBTRACTION of two 1- bytes


hexadecimal numbers stored at ______ and __________. Store the results
immediately after the end of the block. 20
H) Enter the program on the microprocessor kit. 05
I) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 3

A) Write a program that MULTIPLIES two 1- bytes hex numbers stored in


consecutive memory locations starting from _______. Store the two bytes result in
consecutive memory locations starting from _________ beginning with lower order
byte. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 4

A) Write a program that DIVIDES two 1 byte hex number where the dividend is
stored in _________ and the divisor is stored in _________. Store the quotient and
the remainder in the next consecutive memory locations respectively. 20
A) Enter the program on the microprocessor kit. 05
B) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location starting at_______. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

D) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location starting at_______. 20
E) Enter the program on the microprocessor kit. 05
F) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

HIGHER SECONDARY EDUCATION – PUNE


Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

G) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location starting at_______. 20
H) Enter the program on the microprocessor kit. 05
I) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 13

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location in REVERSE ORDER starting at_______. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

J) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location starting at_______. 20
K) Enter the program on the microprocessor kit. 05
L) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

HIGHER SECONDARY EDUCATION – PUNE


Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 11

M) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that TRANSFERS the entire block data to
the new location starting at_______. 20
N) Enter the program on the microprocessor kit. 05
O) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 5

A) A block of data is stored in memory locations from _____ to _______. Another


block of data having the same length is stored in memory locations starting from
_____. Write a program to EXCHANGE the contents of these two blocks. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 6

A) A block of data is stored in memory locations from _____ to _______. Write a


program to find the SMALLEST or GREATEST number from this block. Store
the results immediately after the end of the block. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 7

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that counts the OCCURRENCE of the
number ____ in the given block. Storethe result in ______. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 8

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that counts the EVEN or ODD of the
numbers in the given block. Storethe result in ______. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 9

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that searches for the FIRST
OCCURRENCE of the data byte ____ in the given block. Store the address of this
occurrence in the HL pair. If number is not found, then HL pair must containsAA. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 10

A) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that performs ADDITION of given
BLOCK of data. UseB register to store any carry generated during the addition of
bytes. Storethe result at two consecutive memory locations. 20
B) Enter the program on the microprocessor kit. 05
C) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05

MAHARASHTRA STATE BOARD OF SECONDARY AND


HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 10

D) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that performs ADDITION of given
BLOCK of data. UseB register to store any carry generated during the addition of
bytes. Storethe result at two consecutive memory locations. 20
E) Enter the program on the microprocessor kit. 05
F) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
MAHARASHTRA STATE BOARD OF SECONDARY AND
HIGHER SECONDARY EDUCATION – PUNE
Computer Science D9 (Paper – II)
H.S.C. Board Practical Examination: 2017-2018
Centre: ___________________________ Jr. College No.: ____________
Time: 7.30 am Batch: Date: /02/2018
-===============================================================================================================================================================================================================================================================================

Experiment No. 10

G) A block of data is stored in memory locations from _____. The length of the block
is stored at ________. Write a program that performs ADDITION of given
BLOCK of data. UseB register to store any carry generated during the addition of
bytes. Storethe result at two consecutive memory locations. 20
H) Enter the program on the microprocessor kit. 05
I) Execute the program. Write the contents of data memory locations before and after
execution as well as the contents of the registers used in the program after execution
and also the bit contents of all five flags individually. Verify the results. 05
Experiment No.1
Aim :- Write assembly language program to add two 8-bit (hexadecimal)
Numbers. The numbers are storage at memory location 1000H and 1001H.
Store the result at memory location 1002H.

Example :- i) Numbers are 09H and 01H.


ii) Numbers are 11H and 22H.

Given data :- i) 1000H – 09H / 11H


ii) 1001H – 01H / 22H
iii) 1002H – Result

Assembly Language Program :-

Memory Label Mnemonics Hex Comments


location Opcode Code
Operand
1003 LXI 21 Get Address of 1st No. in HL-
H,1000H pair
1004 00
1005 10
1006 MOV A,M 7E Get 1st No. in accumulator
1007 INX H 23 Increment HL pair by 1
1008 ADD M 86 Add 1st and 2nd No.
1009 STA 1002H 32 Store sum in 1002H
100A 02
100B 10
100C HLT 76 Stop the Program

Result :- After execution of program, Addition of two numbers, result is formed to


be
i) 0AH in memory location in 1002H
ii) 33H in memory location in 1002H

- E N D-
Experiment No.2
Aim :- Write assembly language program to Subtract two 8-bit (hexadecimal)
Numbers. The numbers are Store at memory location 1000H and 1001H.
Store the result at memory loaction 1002H.

Example :- i) Numbers are 09H and 01H.


ii) Numbers are 22H and 11H.

Given data :- i) 1000H – 09H


ii) 1001H – 01H
iii) 1002H – Result

Assembly Language Program :-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
1003 LXI 21 Get Address of 1st No. in HL-
H,1000H pair
1004 00
1005 10
1006 MOV A,M 7E Get 1st No. in accumulator
1007 INX H 23 Increment HL pair by 1
1008 SUB M 96 Subtract 1st No. from 2nd No.
1009 STA 1002H 32 Store Result in 1002H
100A 02
100B 10
100C HLT 76 Stop the program

Result :- After execution of program, subtraction of two numbers, result is formed


to be
i) 08H in memory location in 1002H
ii) 11H in memory location in 1002H
Experiment No.3
Aim :- Write assembly language program to find smaller/greater of two
numbers

Example :- i) Numbers are 84H and 99H.

Given data :- i) 1000H – 84H


ii) 1001H – 09H
iii) 1002H – Result

Assembly Language Program :-

Memory Label Mnemonics Hex Comments


location Opcode Code
Operand
1003 LXI H,1000H 21 Get address of 1st No.in
HL-pair
1004 00
1005 10
1006 MOV A,M 7E Get 1st No.in
accumulator
1007 INX H 23 Increment HL pair by 1
1008 CMP M BE Add 1st and 2nd No.
1009 JNC AHEAD D2 Store sum in 1002H
100A 0D
100B 10
100C MOV A,M 7E End program
100D AHEAD: STA 1002H 32
100E 02
100F 10
1010 HLT 76

Result :- After execution of program, greatest number 84H was found at memory
location 1002 H

Note:-JCN instruction when replaced with JC instruction gives smallest of


two numbers.

- E N D-
Experiment No.4
Aim :- Write an assembly language program to convert of memory location
C000 H to an ASCII character memory location C000 contains a single
hexadecimal digit. Store result at location C001 H

Input :- (C000) = 0C

Assembly Language Program :-

Memory Label Mnemonics Hex Comments


location Opcode Code
Operand
1000 LDA C000 3A Get DATA
1001 00
1002 C0
1003 CPI 10 FE is DATA 10 OR
MORE
1004 0A
1005 JC ASCZ DA Jump if carry
1006 0A
1007 10
1008 ADI ‘A’-‘9’-‘1’ C6 Yes add offset
1009 07
100A ASCZ: ADI ‘O’ C6 Add offset for ASCII
100B 30
100C STA C001 32 Store ASCII result
100D 01
100E C0
100F HLT 76

Result :- If [C000] = 0C then Result = [C001] = 43

-E N D-
Experiment No.5
Aim :- Write ALP to add all the BCD numbers in a block from 1000 H to 8008
H . Store Sum at memory location 100A H. [Assume sum is 8 bit]

Input : -

1000 H = 01 1003 H = 01 1006 H= 01


1001 H = 01 1004 H = 01 1007 H = 01
1002 H = 01 1005 H = 01 1008 H = 01

100A H= RESULT

Assembly Language Program :-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100B LXI H,1000H 21 ; HL pair at starting
address
100C 00
100D 10
100E MVI C,09H 0E ; Register C as counter
100F 09
1010 XRA A AF ; Clear Accumulator
1011 UP: ADD M 86 ;[A] + [H][L]  [A]
1012 DAA 27 ; Decimal Addition
1013 INX H 23
1014 DCR C 0D ;Decrement Loop
counter by 1
1015 JNZ UP C2 ; Go up until C=0
1016 11
1017 10
1018 STA 100AH 32 ;Store BCD sum at
memory 100A H
1019 0A
101A 10
101B HLT 76 ; Halt

Result : - BCD addition was found at location 100A H and was = 09


Experiment No. 6
Aim : -Write an ALP to copy block of four consecutive bytes storage from
1000 H to 1003 H. Transfer the entire block to new location from C004 H. .

Input :-1000 = 11H C004 H = result


1001 = 22H C005 H = result
1002 = 33H C006 H = result
1003 = 44H C007 H = result

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
1009 LXI H,1000H 21 ;Load HL Register Pair
100A 00
100B 10
100C LXI B,C004H 01 ;Load BC Register Pair
100D 04
100E C0
100F MVI C,04H 0E ; Set Counter as 04
1010 04
1011 BACK: MOV A,M ; Get first number in
7E
Accumulator
1012 STAX B ; Store the content of A
02
to Memory
1013 INX H ; Increment the register
23
pair
1014 INX B ; Increment the register
03
pair
1015 DCR C ; Decrement Counter by
0D
1
1016 JNZ BACK ; if Z=0 the perform
C2
loop
1017 10
1018 10
HLT 76 ;Stop the Program

Result :-
After execution of program the data in memory block 1000H – 1003 H
was copied from 1004 H to 1007 H as follows
1000 = 11H 1004 H = 11 H
1001 = 22H 1005 H = 22 H
1002 = 33H 1006 H = 33 H
1003 = 44H 1007 H = 44 H
-E N D -
Experiment No. 7

Aim :- A block of data is stored in memory location from 1000H to 1004H.


Write an assembly language Program to shift the data contain of block in
reverse order storing from memory location C005H.
Input :-
1000H = 01H 1003H = 04H
1001H = 02H 1004H = 05H
1002H = 03H

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 100AH ;Set up H – L pair as
21
pointer to source
100BH 04
100CH 10
100DH LXI D, C005H ;Set up DE as a pointer
11
to destination
100EH 05
100FH C0
1010H MVI C, 05H 0E ;Set up counter C = 05
1011H 05
1012H TOP: MOV A, M 7E ;Get data from memory
1013H STAX D 12 ;Store it at desetination
1014H DCX H ;Decrement source
2B
Pointer
1015H INX D 13 ;Increment D
1016H DCR C 0D ;Decrement count
1017H JNZ TOP ;Jump is count is not
C2
zero
1018H 12
1019H 10
101AH HLT 76 ;Stop

Result :- After execution of program number are found 05, 04,03,02,01 in


successive memory location C005H

- E N D -
Experiment No. 8

Aim :- Write an ALP to count total number occurrences of data bytes 9CH in
a memory block of length 10 bytes starting from 1000H. Store the count in
register E.
Input :-
1000H = 11H 1003H = 44H 1006H = 9CH
1009H = 77H
1001H = 9CH 1004H = 9CH 1007H = 66H
1002H = 33H 1005H = 55H 1008H = 9CH

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up H – L pair as
21
pointer to source
100BH 00
100CH 10
100DH MVI C,0AH ;Set counter as 10
0E
number
100EH 01
100FH MVI E,00H 1E ; Initialize E reg. as 00H
1010H 00
1011H MVI A,9CH ; Initialize A reg. as
3E
9CH
1012H 9CH
1013H TOP: CMP M ; Compare the content
BE of memory with content
of A.
1014H JNZ DOWN ; if Z= 1 then increment
C2
the content of reg. E
1015H 18
1016H 10
1017H INR E IC
1018H DOWN: INX H ; Increment of HL reg.
23
pair
1019H DCR C 0D ;Decrement the counter
101AH JNZ TOP C2 ;If Z= 0 perform loop
101BH 13
101CH 10
101DH HLT 76 ;Stop the program

Result :- After execution of program count in register E was 04H

- E N D -
Experiment No. 9
Aim :- A block of data is stored in memory location from 1000H to 1002H.
Another block is stored from 1003H to 1005H. Write an ALP to exchange
these two block of data with each other.
Input :-
1000H = 11H 1003H = 44H
1001H = 9CH 1004H = 9CH
1002H = 33H 1005H = 55H

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up HL pair as
21
pointer to source
100BH 00
100CH 10
100DH LXI D, 1003H ;Set up DE pair as
11
pointer to destination
100EH 03
100FH 10
1010H MVI C,03H 0E ; Set counter
1011H 03
1012H TOP: MOV A,M 7E ; Transfer no. in Acc.
1013H MOV B,A 47 ; Copy Acc into B reg.
1014H LDAX D ; Load Acc from
1A
memory (DE)
1015H MOV M,A ; Copy Acc to memory
77
(HL)
1016H MOV A,B 78 ;Copy Reg. B to reg. A
1017H STAX D ; Store the content of
12
Acc. Into memory
1018H INX H 24 ; Increment the HL
1019H INX D 14 ; Increment the DE
101AH DCR C 0D ; Decrement the C reg.
101BH JNZ TOP C2 ; If Z= 0 perform loop
101CH 12
101DH 10
101EH HLT 76 ; Stop the Program
Result :- After execution of program the content of two block are exchange.

- E N D -
Experiment No. 10
Aim :- Write an ALP the divide one byte Hexadecimal number, when
dividend is stored in memory location 1000H and divisor is stored in memory
location 1001H. Store the quotient and reminder in memory location 1002H
and 1003H
Input :-
1000H = 24H Dividend
1001H = 02H Divisor

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up HL pair as
21
pointer to source
100BH 00
100CH 10
100DH MVI C,00H 0E ; Set C reg. as 00
100EH 00
100FH MOV A,M 7E ; Get dividend in Acc.
1010H INX H 23 ; Increment HL Reg.
1011H UP: CMP M ; Compare the Acc.
BE
With Memory
1012H JC DOWN DA ; If C= 0 the down
1013H 1A
1014H 10
1015H SUB M 12 ; Perform subtraction
1016H INR C 0C ; Increment C Reg.
1017H JMP UP C3 ; jump to the top
1018H 11
1019H 10
101AH DOWN: INX H 23 ; Increment HL Reg.
101BH MOV M,C ; Copy content of C to
71
Memory
101CH INX H 23 ; Increment HL Reg.
101DH MOV M,A ; Copy content of A to
77
Memory
101EH HLT 76 ; Stop the Program
Result :- After execution of program the content of 1002H = 12H and
1003H = 00H.
- E N D -
Experiment No. 11
Aim :- Write an ALP that interchange digits of number stored at location
1000H and stores the result at 1001H. Also perform the original number and
the interchanged number and store the result at location 1002H
Input :-
1000H = 23H 1002H – 55H
1001H = 32H

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up HL pair as
21
pointer to source
100BH 00
100CH 10
100DH MOV A,M ; Copy the content of
7E
memory to Acc.
100EH RRC 0F ;Rotate the content
100FH RRC 0F ;of the accumulator
1010H RRC 0F ;4 times
1011H RRC 0F ;Right side
1012H INX H 23 ; Increment the HL
1013H MOV M,A ; Store interchange in
77
memory
1014H DCX H 2B ; Decrement HL
1015H ADD M ; Perform the original
86 number with
interchanged number
1016H STA 1002H ; Store the result at
32
memory
1017H 02
1018H 10
1019H HLT 76 ; Stop the Program
101AH

Result :- After execution of program the content of 1002H = 55H.

- E N D -
Experiment No. 12
Aim :- Write an ALP to count the number of odd data bytes occurring a
block of data stored from location 1001h to 1004H. Store the result at location
1005H
Input :-
1000H = 01H 1002H = 03H 1004H = 05
1001H = 04H 1003H = 06H 1005H = result

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up HL pair as
21
pointer to source
100BH 00
100CH 10
100DH MVI C,05H 0E ; Set Counter as 05
100EH 05
100FH MVI B,00H 06 ; Initialize reg B = 0
1010H 00
1011H TOP: MOV A,M ; Get first number in
7E
Acc
1012H RRC ; Rotate the content of
0F
Acc right
1013H JNC DOWN D2 ; if C= 0 then down
1014H 17
1015H 10
1016H INR B ; if C=1 then increment
04
the content of reg B
1017H DOWN: INX H ; Increment the HL
23
reg.pairs
1018H DCR C 0D ; Decrement the reg. C
1019H JNZ TOP C2 ; If Z= 0 then goto TOP
101AH 11
101BH 10
101CH MOV A,B 78 ; Store the result at
101DH STA 1005H 32 ; the memory location
101EH 05 ; 1005 H
101FH 10
1020H HLT 76 ; Stop the Program

Result :- After execution of program the content of 1005H = 03H.

- E N D -
Experiment No. 13
Aim :- Write an ALP to count the number of ONE’S in an 8bit hexadecimal
number stored at 1000H. Store the result at location 1001H
Input :-
1000H = 98H => 10011000
1001H = 03H

Assembly Language Program:-


Memory Label Mnemonics Hex Comments
location Opcode Code
Operand
100AH LXI H, 1000H ;Set up HL pair as
21
pointer to source
100BH 00
100CH 10
100DH MVI C,08H 0E ; Set Counter as 05
100EH 08
100FH MVI B,00H 06 ; Initialize reg B = 0
1010H 00
1011H MOV A,M ; Get first number in
7E
Acc
1012H TOP: RRC ; Rotate the content of
0F
Acc right
1013H JNC DOWN D2 ; if C= 0 then down
1014H 17
1015H 10
1016H INR B ; if C=1 then increment
04
the content of reg B
1017H DOWN: INX H ; Increment the HL
23
reg.pairs
1018H DCR C 0D ; Decrement the reg. C
1019H JNZ TOP C2 ; If Z= 0 then goto TOP
101AH 12
101BH 10
101CH MOV A,B 78 ; Store the result at
101DH STA 1001H 32 ; the memory location
101EH 01 ; 1005 H
101FH 10
1020H HLT 76 ; Stop the Program

Result :- After execution of program the content of 1001H = 03H.

- E N D -

You might also like