...
UGC NET CS 2014 Dec – paper-3
September 19, 2024
UGC NET CS 2014 Dec – paper-3
September 19, 2024
UGC NET CS 2014 Dec – paper-3
September 19, 2024
UGC NET CS 2014 Dec – paper-3
September 19, 2024

UGC NET CS 2014 Dec – paper-3

Question 5
How many times will the following loop be executed ?
LXI B, 0007 H
LOP : DCX B
MOV A, B
ORA C
JNZ LOP
A
05
B
07
C
09
D
00
Question 5 Explanation: 
LXI B, 0007 H // Load register pair B with value (00)H and C with value (07)H
LOP :
DCX B // Decrement register pair BC i.e. decrease C because B is already 0.
MOV A, B // Move value of B to A. It means A is 0 after first iteration of loop LOP.

ORA C // It means perform OR operation between register A and C and store the result into register A. So A = (06)H after first iteration of loop.
JNZ LOP // Jump to LOP if it is not zero.

So this way LOP will be executed 7 times.

Correct Answer: B
Question 5 Explanation: 
LXI B, 0007 H // Load register pair B with value (00)H and C with value (07)H
LOP :
DCX B // Decrement register pair BC i.e. decrease C because B is already 0.
MOV A, B // Move value of B to A. It means A is 0 after first iteration of loop LOP.

ORA C // It means perform OR operation between register A and C and store the result into register A. So A = (06)H after first iteration of loop.
JNZ LOP // Jump to LOP if it is not zero.

So this way LOP will be executed 7 times.

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x
error: Alert: Content selection is disabled!!