Assembly language programming in c programming language

(1)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,61;

         mov bx,10;

         add bx,ax;

    }

printf("\n%d",_BX);

getch();

}

 

(a)61

(b)10

(c)71

(d)0

for answer and explanation click me 

(2)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,10;

         mov bx,20;

         mov cx,30;

         add ax,bx;

         sub ax,cx;

     }

printf("%d",_AX);

getch();

}

(a)-20

(b)0

(c)20

(d)-10

for answer and explanation click me 

(3)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,10;

         mov bx,20;

         mov cx,30;

         add ax,bx;

         add bx,cx

   }

printf("%d  %d   %d",_AX,_BX,_CX);

getch();

}

(a)30 50 30

(b)10 20 30

(c)10 30 60

(d)30 20 10

 for answer and explanation click me 

(4)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,10;

         mov cx,20;

         inc cx;

         div 2;

     }

printf("%d ",_AX);

getch();

}

(a)5

(b)10

(c)15

(d)Compiler error

for answer and explanation click me 

(5)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,15;

         mov cx,12;

         mov bx,3;

         div bx;

   }

printf("%d ",_AX);

getch();

}

(a)5

(b)4

(c)9

(d)Compiler error

for answer and explanation click me 

(6)What will be output of following c program?

void main()

{

clrscr();

asm{

         mov ax,15;

         mov bx,3;

         inc bx;

         mul bx;

   }

printf("%d ",_AX);

getch();

}

 

(a)45

(b)48

(c)60

(d)Compiler error

for answer and explanation click me 

(7)What will be output of following c program?

void main()

{

int i=0;

clrscr();

asm mov dx,25;

for(i=0;i<5;i++)

asm dec dx;

printf("%d ",_DX);

getch();

}

 

(a)24 23 22 21 20

(b)24 23 22 21

(c)20

(d)Compiler error

for answer and explanation click me 

(8)What will be output of following c program?

void main()

{

int j=5;

asm mov cx,10;

clrscr();

asm OR cx,j;

printf("%d ",_CX);

getch();

}

 

(a)5

(b)10

(c)15

(d)20

for answer and explanation click me 

(9)What will be output of following c program?

void main()

{

clrscr();

asm {

         mov ax,15;

         mov dx,2;

         and dx,ax;

         not ax;

     }

printf("%d %d ",_AX,_DX);

getch();

}

 

(a)-15 2

(b)15 -15

(c)15 -16

(d)-16 2

for answer and explanation click me 

(10)What will be output of following c program?

void main()

{

clrscr();

         asm mov ax,15;

         asm mov bx,5;

         india:

         asm inc ax;

         asm dec bx;

         asm jnz india;

printf("%d ",_AX);

getch();

}

(a)10

(b)20

(c)30

(d)Infinite loop

for answer and explanation click me 

Post a Comment