Knowee
Questions
Features
Study Tools

How many times JNZ instruction is executed in the following program? MVI C, 20H LOOP: DCR C JNZ LOOP A) 20 B) 30 C) 32 D) 40

Question

How many times does the JNZ instruction execute in the following program?

MVI C, 20H
LOOP: DCR C
      JNZ LOOP
  • A) 20
  • B) 30
  • C) 32
  • D) 40
🧐 Not the exact question you are looking for?Go ask a question

Solution

The JNZ (Jump if Not Zero) instruction in the given assembly language program is executed as long as the value in the C register is not zero.

The program starts by moving the value 20H (which is 32 in decimal) into the C register.

Then it enters a loop where it decrements the value in the C register by 1 and then checks if the value is zero.

If the value is not zero, it jumps back to the start of the loop.

This continues until the value in the C register is zero, at which point the JNZ instruction is not executed and the program ends.

So, the JNZ instruction is executed 32 times, which corresponds to option C) 32.

This problem has been solved

Similar Questions

How many times will the following loop runfor(c = 1; c < 20; c=c+5) {document.write("C : " + c );document.write("<br />");

How many times is the loop block entered when the following code executes?fоr(int i=16; і < 28; i+=2) {    <code inside loop block>}

How many T-states are required to execute the following instruction? MVI A,16H A) 4 T-states B) 7 T-states C) 10 T-states D) 14 T-states

How many times will the following loop execute? What will be the final value?int a=1,x=0;do{x=a++ *a,}while(a<=5),System out.println(x);}

The instruction cycle is based on the following parts: (in order)a.execution and fetchb.execution and storec.fetch and stored.fetch and execution

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.