GATE EC 2015 Set 3 — Question 26
Go beyond PYQs with Success TrackerAI-powered personalised practice and doubt support. Unlimited practice on eligible plans; AI usage limits apply.MCQ+1 / -0.33EasyMachine Instructions & AddressingComputer OrganizationDigital Circuits
Digital Circuits → Computer Organization → Machine Instructions & Addressing
Last updated
Question
Which one of the following 8085 microprocessor programs correctly calculates the product of two 8-bit numbers stored in registers B and C?
Correct answer
(C) [code]
Solution
The problem is to find the product of two 8-bit numbers, say in registers B and C. The product B × C can be calculated by adding C to an accumulator B times.Let's analyze the given options:Option A:
The code is logically and syntactically flawed. The
This program initializes A to 0 and then enters a loop that decrements B until it becomes zero. However, inside the loop, it does not perform any addition. The accumulator A remains 0 throughout. This does not calculate the product.Option C:
This program correctly implements multiplication by repeated addition. It initializes the result in A to 0. Then, it loops B times. In each iteration, it adds the value of C to A. When the loop finishes (B becomes 0), the accumulator A holds the sum C + C + ... + C (B times), which is the product B × C. This is the correct program.Option D:
This program is incorrect. The loop structure is broken (
MVI A, 00H ; A <- 00H. Zero flag is set.
JNZ LOOP ; Jumps if Zero flag is not set. Since Z=1, this jump is not taken.
CMP C ; Irrelevant instruction here.
LOOP: DCR B ; Label is here. This is a syntax error in most assemblers.
HLT
The code is logically and syntactically flawed. The
JNZ instruction will not execute the jump. The label LOOP is misplaced after the instruction that uses it. This program will not work.Option B:MVI A, 00H ; A <- 00H
CMP C ; Compares A with C, sets flags. Does not contribute to multiplication.
LOOP: DCR B ; Decrements B.
JNZ LOOP ; Jumps to LOOP if B is not zero.
HLT
This program initializes A to 0 and then enters a loop that decrements B until it becomes zero. However, inside the loop, it does not perform any addition. The accumulator A remains 0 throughout. This does not calculate the product.Option C:
MVI A, 00H ; Initialize accumulator A (for the result) to 0.
LOOP: ADD C ; Add the contents of register C to the accumulator A. A <- A + C.
DCR B ; Decrement the counter in register B.
JNZ LOOP ; If B is not zero (Zero flag is not set), jump back to LOOP.
HLT ; Halt the processor.
This program correctly implements multiplication by repeated addition. It initializes the result in A to 0. Then, it loops B times. In each iteration, it adds the value of C to A. When the loop finishes (B becomes 0), the accumulator A holds the sum C + C + ... + C (B times), which is the product B × C. This is the correct program.Option D:
MVI A, 00H ; A <- 00H
ADD C ; A <- A + C. A now holds C.
JNZ LOOP ; Jumps if A is not zero. This will jump to LOOP.
LOOP: INR B ; Label is here. Increments B.
HLT
This program is incorrect. The loop structure is broken (
JNZ LOOP before the label). It increments B instead of using it as a counter. It only adds C once.Therefore, option (C) is the only program that correctly calculates the product.Continue learning with Success Tracker
A step still unclear? Work through it with support
Use Success Tracker to ask about the reasoning, then try another GATE EC question to check your understanding.
AI-powered practice· Unlimited practice on eligible plans
- PYQs with solutions
- Attempt available previous-year questions, then compare your reasoning with the worked solution. Coverage varies by stream.
- Practice that adapts
- Choose a topic, work on weaker areas and bookmark questions to revisit. Your attempts feed your progress tracking.
- AI doubt support
- Ask follow-up questions about a step or concept while practising, instead of stopping at the final answer.
Unlimited practice is available on eligible plans. Free practice and AI usage have limits; check the current plan allowances before choosing.
This page stays readable without an account. AI responses can be wrong; check them against the solution and source material.
More questions on Computer Organization
2026 Set 1 Q20In the circuit shown in the Figure, A and B are logic inputs and Y is the logic output. Which of…2026 Set 1 Q27A binary ripple counter is designed to count to . Which of the following…2026 Set 1 Q35The negative edge triggered JK flip-flop in the Figure has J and K inputs tied to Logic High and a…2026 Set 1 Q42The address of the first location of a 256 kilo byte (KB) memory is . Choose the correct…2026 Set 1 Q45What is the complement of ?