🎓 BookMCQ
← Back to 5. The 8085 Microprocessor

📝 Pin Description of 8085 Microprocessor (45 MCQs)

Forty-Pin Package and Functional Pin Groups

The Intel 8085 is supplied in a 40-pin integrated-circuit package. Its pins connect the processor with memory, input/output devices, clock circuitry and external control hardware. They are commonly classified into address and data lines, control and status signals, interrupt inputs, serial communication, DMA control, clock and reset connections, and power-supply pins.

Multiplexed Address and Data Pin Functions

Pins AD0–AD7 carry the lower-order address during T1 and become bidirectional data lines during subsequent portions of a bus cycle. Pins A8–A15 provide the higher-order address. ALE enables an external latch to preserve the lower address. This arrangement gives the processor a 16-bit address bus and an 8-bit data bus using fewer physical pins.

Read, Write, Status and Bus-Control Connections

RD and WR are active-low signals controlling read and write operations. IO/M distinguishes memory from input/output access, while S1 and S0 provide additional machine-cycle status information. READY supports wait states. HOLD requests external bus control, and HLDA acknowledges the request after the processor releases its buses.

Interrupt, Serial, Clock and Reset Pins

The five interrupt inputs are TRAP, RST 7.5, RST 6.5, RST 5.5 and INTR, with INTA as the active-low interrupt acknowledgement output. SID and SOD handle serial input and output. X1 and X2 connect the clock source, CLK OUT provides a clock output, RESET IN initializes the processor, and RESET OUT supports external reset coordination.

Power Supply and External Circuit Connections

The 8085 operates from a single +5 V supply connected to VCC, with GND providing the reference connection. Its address and data pins connect to memory interfaces, while control signals connect to decoder and peripheral circuits. The clock, reset and READY connections support correct startup, synchronization and communication with external devices.

Misconceptions About the 8085 Pin Configuration

'AD0–AD7 are exclusively data pins' overlooks their multiplexed address function. 'RESET IN and RESET OUT perform identical jobs' is incorrect because one resets the processor while the other provides reset-status output. 'INTR and INTA are both interrupt inputs' is incorrect because INTA is an output acknowledging an accepted INTR request.

Pin Identification and Functional Group Questions

Practise classifying all major pin groups and identifying their direction and purpose. Distinguish the five interrupt inputs from INTA, SID from SOD, and HOLD from HLDA. Understand ALE, RD, WR and IO/M during bus operations. Examination diagrams may ask for pin functions, active-low signals or connections needed to interface memory and peripherals.

8085 Pin Groups and Signal Terminology

  • VCC - Positive five-volt supply connection.
  • GND - Ground reference connection.
  • ALE - Enables lower-address latching.
  • INTA - Interrupt acknowledgement output.
  • SID/SOD - Serial input and output connections.
  • CLK OUT - Supplies a clock output signal.
11
Easy
22
Medium
12
Hard

📝 All Pin Description of 8085 Microprocessor MCQs

Q1. Which pair of registers can be used as a 16‑bit address register in the SAP‑III CPU?

A.B‑C
B.D‑E
C.H‑L ✅
D.A‑B
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The H‑L pair forms a 16‑bit address because H holds the high‑order byte and L holds the low‑order byte, allowing direct memory access. B‑C and D‑E are also register pairs but are generally used for data manipulation, not address formation. A‑B is not a defined pair in this architecture. In real programs, using H‑L to point to a buffer simplifies pointer arithmetic.

Q2. What is the width of the flag register associated with the accumulator in the SAP‑III computer?

A.2 bits
B.4 bits ✅
C.8 bits
D.16 bits
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The flag register contains four individual flags (S, Z, CY, P), giving it a total width of 4 bits. Two‑bit registers would be insufficient to represent all flags, and an 8‑ or 16‑bit width would be excessive for the four status bits. Knowing the flag width helps designers allocate appropriate pins for status output on a microcontroller board.

Q3. Which flag is set when the accumulator contains a negative value in two’s‑complement representation?

A.Zero (Z)
B.Sign (S) ✅
C.Carry (CY)
D.Parity (P)
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The Sign flag (S) reflects the most‑significant bit of the accumulator; a 1 indicates a negative two’s‑complement number. The Zero flag indicates a zero result, Carry indicates overflow, and Parity checks even‑odd bit count. In embedded control, testing S lets firmware decide whether to branch to error‑handling code for negative sensor readings.

Q4. How many bits are used for the program counter in the SAP‑III system?

A.8 bits
B.12 bits
C.16 bits ✅
D.24 bits
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: The program counter is a 16‑bit register, allowing it to address up to 65,536 memory locations. An 8‑bit counter would limit programs to 256 bytes, which is insufficient for most applications. Understanding the PC size is crucial when planning firmware size and memory layout for devices such as handheld calculators.

Q5. Which register holds the low‑order byte of a memory address when using a register pair?

A.Accumulator (A)
B.B register
C.L register ✅
D.H register
💡 Difficulty: easy | ✅ Correct: C

📖 Explanation: In a register pair, the low‑order byte resides in the second register; for H‑L, L contains the low‑order byte while H holds the high‑order byte. The accumulator is not part of a pair, and B and H are high‑order components of their respective pairs. This knowledge is applied when loading a pointer to a data table stored in RAM.

Q6. If the accumulator after an addition contains the binary value 1001 0110, which flag(s) will be set?

A.Zero only
B.Sign only
C.Carry only
D.Sign and Parity ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The most significant bit is 1, so the Sign flag (S) is set. The number of 1‑bits is five, an odd count, so the Parity flag (P) is reset; however, the question asks which flags will be set, so only S is set. Zero and Carry are not set because the result is neither zero nor did an overflow occur. This scenario mirrors checking status after adding sensor offsets.

Q7. A programmer wants to increment a 16‑bit counter stored in the D‑E register pair. Which instruction sequence correctly performs the operation without affecting other registers?

A.INX D
B.INX DE ✅
C.INX H
D.INX B
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The correct mnemonic is INX DE, which increments the combined D‑E pair as a 16‑bit value. INX D is not a valid instruction; INX H and INX B would modify different pairs, potentially corrupting unrelated data. Proper use of INX DE ensures that only the intended counter changes, a common requirement in timer‑driven embedded loops.

Q8. During a subtraction operation, the Carry flag is cleared. What does this indicate about the result?

A.The result is negative
B.An underflow occurred
C.The result is zero
D.No borrow was needed ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: When subtracting using two’s‑complement, a cleared Carry flag means no borrow was required, implying the minuend was larger than or equal to the subtrahend. It does not directly indicate negativity or zero; those are signaled by the Sign and Zero flags respectively. Engineers rely on this behavior to detect when a countdown reaches zero without extra logic.

Q9. Which of the following statements correctly describes the relationship between the Sign and Zero flags after an arithmetic operation?

A.Both can be 1 simultaneously ✅
B.Both are always opposite
C.Sign is set only if Zero is reset
D.Zero is set only if Sign is reset
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: Both flags are independent; an operation that yields a result of zero will set Z while S remains 0 because the sign bit is 0. Conversely, a negative non‑zero result sets S while Z stays 0. Therefore they can never both be 1, but they are not mutually exclusive in the sense of being always opposite. Understanding this helps avoid incorrect branching decisions.

Q10. A system designer connects an external LED to the Sign flag pin. What behavior should they expect when the accumulator holds a negative result?

A.LED stays off
B.LED blinks rapidly
C.LED turns on ✅
D.LED toggles each clock cycle
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: The Sign flag pin goes high (logic 1) when the accumulator’s most‑significant bit is 1, indicating a negative value. Driving an LED from this pin will cause it to illuminate whenever a negative result is produced. It will not blink on its own; the LED’s state changes only when the flag changes due to program execution.

Q11. If a programmer uses the H‑L pair as a pointer to a data buffer and then executes MOV A,M, which register content is transferred to the accumulator?

A.Content of register H
B.Content of register L
C.Byte at memory address formed by H and L ✅
D.Immediate data from the instruction
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: MOV A,M reads the memory location pointed to by the H‑L pair; the combined 16‑bit address formed by H (high) and L (low) selects the byte to fetch. The registers themselves are not transferred. This operation is typical when scanning an array stored in RAM, allowing the CPU to load each element sequentially.

Q12. When the accumulator holds the value 1111 1111 after an addition, which flags are set?

A.Zero and Carry
B.Sign and Carry
C.Sign and Parity ✅
D.Zero and Parity
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The result 1111 1111 has the most‑significant bit set, so the Sign flag is 1. The number of 1‑bits is eight, an even count, so the Parity flag is set. Zero is not set because the value is not zero, and Carry depends on overflow, which is not indicated by the result alone. Engineers often check S and P together to detect overflow conditions in signed arithmetic.

Q13. A microcontroller uses the Carry flag to trigger an interrupt after a multi‑byte addition. Which condition must be true for the interrupt to fire?

A.Result is zero
B.Result is negative
C.A final carry out of the most significant bit ✅
D.Parity is odd
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The interrupt is generated when the Carry flag is set, which occurs when the addition produces a carry out of the most significant bit, indicating an overflow beyond 8 bits. Zero, Sign, and Parity are unrelated to the carry condition. This mechanism is useful in implementing arbitrary‑precision arithmetic where each byte’s overflow signals the next higher byte to increment.

Q14. Consider a program that repeatedly uses INX H to traverse a memory block. Which register pair provides the high‑order address byte, and how does it change after each INX?

A.H‑L; H increments, L unchanged ✅
B.H‑L; L increments, H unchanged
C.B‑C; B increments, C unchanged
D.D‑E; D increments, E unchanged
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: INX H increments the 16‑bit H‑L pair as a unit, adding 1 to the low‑order byte (L) and propagating any overflow into H. Thus H may change when L wraps from FF to 00. The other pairs are unrelated to the INX H instruction. Understanding this behavior is essential when writing loops that scan contiguous memory regions.

Q15. If the accumulator contains the binary pattern 0000 0000 after an operation, which flag(s) will be set?

A.Zero only
B.Sign only
C.Zero and Parity ✅
D.Zero, Sign, and Parity
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: When the accumulator is zero, the Zero flag is set. The parity of zero is even (zero 1‑bits), so the Parity flag is also set. The Sign flag remains cleared because the most‑significant bit is 0. Therefore both Zero and Parity are active. This scenario often appears after clearing a register with the XRA A instruction.

Q16. A designer wants to use the flag pins to drive a four‑digit seven‑segment display showing status codes. Which limitation of the flag register must they consider?

A.Only two flags are available
B.Flags cannot be read directly
C.Flags are read‑only outputs
D.Only four bits can be displayed at once ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The flag register provides exactly four status bits, so only four independent pieces of information can be output simultaneously without additional encoding. While the flags are readable by software, they are output pins that can be wired to external hardware. This limitation requires designers to encode multiple status conditions into the four available bits.

Q17. When performing a logical AND between the accumulator and register B, which flags are affected?

A.All flags are updated
B.Only Zero and Sign are updated
C.Only Carry is updated
D.No flags are changed ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: Logical AND does not generate a carry, so the Carry flag remains unchanged. It does affect the Zero flag (set if result is zero) and the Sign flag (set if result’s MSB is 1). Parity may also be updated depending on the implementation, but many 8085 variants leave it unchanged. Understanding flag effects guides programmers in choosing instructions for condition testing.

Q18. A programmer needs to compare two 16‑bit numbers stored in D‑E and H‑L pairs. Which sequence correctly sets the flags for the comparison without altering the original data?

A.MOV A,D; CMP E; MOV A,H; CMP L
B.LDAX D; CMP H; LDAX H; CMP L
C.MOV A,D; SUB H; MOV A,E; SUB L ✅
D.CMP DE,HL (hypothetical)
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: The correct method is to load each high byte into the accumulator and subtract the corresponding high byte, then repeat for the low bytes, preserving the original registers. Option C follows this pattern: MOV A,D; SUB H sets flags for the high‑order comparison, then MOV A,E; SUB L for the low‑order part. The other options either misuse instructions or assume a non‑existent CMP DE,HL instruction.

Q19. Which pin on the 8085 microprocessor carries the output of the Sign flag?

A.SID
B.S0 ✅
C.S1
D.S2
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: The Sign flag output is on pin S1 (sometimes labeled S). Pin S0 carries the Zero flag, S2 the Carry flag, and SID the Parity flag. Knowing the exact pin mapping is vital when designing external status LEDs or interfacing with peripheral logic that reacts to signed‑number results.

Q20. If a program executes INR L followed by DCR L, what will be the state of the Zero flag after the DCR instruction, assuming L initially contained 0xFF?

A.Zero set ✅
B.Zero cleared
C.Zero toggles
D.Zero unchanged
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: L starts at FF, INR increments it to 00 (wrap‑around), setting the Zero flag. DCR then decrements it back to FF, clearing the Zero flag because the result is non‑zero. Therefore after DCR, the Zero flag is cleared. This demonstrates how increment‑decrement sequences can be used to test overflow behavior in loops.

Q21. When the accumulator holds the value 0x7F and an ADD A instruction is executed, which flag(s) will be set?

A.Sign only
B.Carry only
C.Sign and Carry ✅
D.Zero only
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: 0x7F (0111 1111) + 0x7F = 0xFE (1111 1110) with a carry out of the most‑significant bit, so the Carry flag is set. The result’s MSB is 1, so the Sign flag is also set. Zero is not set because the result is not zero. This situation illustrates signed overflow detection when adding two positive numbers.

Q22. A student writes a routine that uses the H‑L pair to copy 256 bytes from one RAM area to another. Which instruction should be used inside the loop to advance the source pointer?

A.INX H ✅
B.INX L
C.DCR H
D.DCR L
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: INX H increments the combined H‑L pair as a 16‑bit address, moving the pointer to the next memory location. INX L would only increment the low byte and ignore overflow into H, causing incorrect addressing after 0xFF. DCR instructions would move the pointer backward. Proper pointer advancement is essential for block‑copy operations.

Q23. If the Parity flag is set after an operation, what can be inferred about the number of 1‑bits in the accumulator?

A.It is odd
B.It is even ✅
C.It is zero
D.It is one
💡 Difficulty: easy | ✅ Correct: B

📖 Explanation: The Parity flag is set when the accumulator contains an even number of 1‑bits. An odd count clears the flag. This rule holds regardless of the accumulator’s numeric value. Engineers often use the Parity flag to implement simple error‑checking schemes in communication protocols.

Q24. During a subtraction, the accumulator result is 0x80. Which flags will be set?

A.Sign only
B.Zero only
C.Sign and Carry
D.Sign and Parity ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: 0x80 (1000 0000) has the MSB set, so the Sign flag is 1. The value contains a single 1‑bit, an odd count, so the Parity flag is cleared. Zero is not set because the result is not zero. Carry depends on whether a borrow occurred; in two’s‑complement subtraction, a borrow occurs when the subtrahend exceeds the minuend, which is not indicated by the result alone. Therefore only Sign is guaranteed to be set.

Q25. A hardware engineer needs to read the status of all four flags using a single I/O port. Which technique allows this without additional decoding logic?

A.Connect each flag to a separate port line
B.Use a multiplexing IC
C.Tie the flags together on a shared bus line
D.Configure the processor to output the flag register on the data bus ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: The 8085 can place the flag register onto the data bus during the RST 5.5 instruction, allowing a single I/O read to capture all four flags simultaneously. Directly wiring each flag to separate port lines would require four pins, and multiplexing adds complexity. Using the built‑in flag‑to‑bus feature simplifies hardware design.

Q26. When executing the instruction DAD H, which registers are affected and how?

A.Adds H‑L to HL and stores result in HL ✅
B.Adds D‑E to DE and stores result in DE
C.Adds B‑C to BC and stores result in BC
D.Adds A to A and stores result in A
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: DAD H adds the contents of the H‑L pair to the HL register pair, storing the 16‑bit sum back in HL and affecting the Carry flag if overflow occurs. It does not involve D‑E, B‑C, or the accumulator. This instruction is commonly used for pointer arithmetic when navigating structures larger than a single byte.

Q27. If a program uses the instruction XRA A, what will be the state of the Zero and Sign flags afterward?

A.Zero set, Sign cleared ✅
B.Zero cleared, Sign set
C.Both cleared
D.Both set
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: XRA A performs a bitwise XOR of the accumulator with itself, yielding 0x00. Consequently, the Zero flag is set because the result is zero, and the Sign flag is cleared because the most‑significant bit is 0. This instruction is frequently employed to quickly clear the accumulator.

Q28. A microprocessor is configured to trigger an external interrupt when the Carry flag becomes 1. Which instruction sequence ensures that the flag is set only after a specific addition?

A.ADD A, B; RST 5.5 ✅
B.ADD A, B; RST 5.6
C.ADD A, B; RST 5.7
D.ADD A, B; RST 5.8
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: RST 5.5 is the dedicated instruction that outputs the flag register onto the data bus, allowing external hardware to sense the Carry flag. The other RST vectors (5.6‑5.8) are not defined for flag output in the 8085 architecture. Using this sequence lets designers create precise interrupt conditions based on arithmetic overflow.

Q29. When the accumulator contains 0xFF and the instruction CMA is executed, which flags change?

A.Only Sign toggles
B.Only Zero toggles
C.Only Parity toggles
D.No flags are affected ✅
💡 Difficulty: medium | ✅ Correct: D

📖 Explanation: CMA complements each bit of the accumulator, turning 0xFF into 0x00. The instruction does not affect any flag registers; they retain their previous values. Therefore none of the flags change. Understanding that CMA is a non‑affecting operation helps avoid unintended side‑effects in algorithms that rely on flag status.

Q30. A programmer wants to test whether the accumulator holds a positive even number. Which combination of flag checks is sufficient?

A.Sign = 0 and Parity = 1 ✅
B.Zero = 0 and Carry = 0
C.Sign = 1 and Parity = 0
D.Zero = 1 and Carry = 1
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: A positive even number has a cleared Sign flag (MSB = 0) and an even number of 1‑bits, so the Parity flag is set. Zero must be considered separately; a zero result also meets these criteria but is often handled as a special case. This combination allows a single branch instruction to detect the desired condition efficiently.

Q31. If the accumulator holds 0x55 and the instruction RLC is performed, what will be the new accumulator value and which flag is affected?

A.0xAA; Carry set ✅
B.0xAA; Carry cleared
C.0xAB; Carry set
D.0xAB; Carry cleared
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: RLC rotates the accumulator left one bit, moving the MSB into the Carry flag and also into the LSB. 0x55 (0101 0101) becomes 0xAA (1010 1010), and the original MSB (0) is placed into the Carry flag, leaving it cleared. This operation is useful for implementing multiply‑by‑2 algorithms.

Q32. When using the instruction DCR H, which flag(s) are guaranteed to be updated?

A.Zero and Sign ✅
B.Carry only
C.Parity only
D.Sign and Zero
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: Decrementing a register affects the Zero flag (set if result becomes zero) and the Sign flag (reflects the new MSB). It does not affect the Carry flag, and Parity may change but is not guaranteed. Therefore Zero and Sign are the flags that are definitively updated after DCR H.

Q33. A system uses the four flag pins to drive a 4‑bit binary display that shows the status of the most recent arithmetic operation. Which limitation must the programmer keep in mind?

A.Flags cannot be directly read by software
B.Only four distinct status conditions can be represented at a time ✅
C.Flags are only valid after logical operations
D.Flag values are inverted when read externally
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: Since only four bits are available, at most four independent pieces of information can be displayed simultaneously. Complex status (e.g., overflow, underflow, parity) must be encoded within these four bits, often by combining flag values into a status code. This restriction influences how diagnostic information is presented to users.

Q34. If the accumulator contains 0x0F and the instruction RRC is executed twice, what is the final accumulator value?

A.60
B.63 ✅
C.240
D.243
💡 Difficulty: medium | ✅ Correct: B

📖 Explanation: RRC rotates right one bit, moving the LSB into the Carry flag and also into the MSB. Starting with 0x0F (0000 1111), the first RRC yields 0x80 (1000 0000). A second RRC rotates 0x80 to 0x40 (0100 0000). However, the correct sequence yields 0x3F (0011 1111) after two rotations if the original LSBs are re‑inserted; the most accurate result is 0x3F. This demonstrates how repeated rotations can reconstruct original bit patterns.

Q35. A developer needs to store the current flag status before calling a subroutine that may alter them. Which instruction pair correctly saves and later restores the flags?

A.PUSH PSW; POP PSW ✅
B.PUSH B; POP B
C.STA flag; LDA flag
D.IN S; OUT S
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: PUSH PSW saves the accumulator and flag register onto the stack, and POP PSW restores them later, preserving all four flags. PUSH B only saves registers B and C, not the flags. Directly storing the flag register with STA/LDA is not possible because the flag register is not memory‑mapped. Therefore the PUSH/POP approach is the proper method.

Q36. When executing the instruction DCR A, which flag is guaranteed to be cleared if the accumulator was initially 0x01?

A.Zero
B.Sign
C.Carry ✅
D.Parity
💡 Difficulty: hard | ✅ Correct: C

📖 Explanation: DCR A decrements the accumulator from 0x01 to 0x00, setting the Zero flag. The Sign flag becomes 0 because the result’s MSB is 0, but it was already cleared. The Carry flag is unaffected by decrement operations, and Parity changes to even (set). Thus the Zero flag is the one guaranteed to be set, not cleared; however the question asks which flag is guaranteed to be cleared—Sign and Carry remain cleared, but Zero becomes set. The correct answer is Carry, which stays cleared.

Q37. A programmer wants to test whether the accumulator result of an addition is both zero and has no carry. Which combination of flag checks will correctly detect this condition?

A.Zero = 1 and Carry = 0 ✅
B.Zero = 0 and Carry = 1
C.Zero = 1 and Sign = 0
D.Parity = 1 and Carry = 0
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: A zero result sets the Zero flag, and the absence of an overflow leaves the Carry flag cleared. Therefore checking Zero = 1 and Carry = 0 precisely identifies the desired situation. The other combinations either miss the zero condition or incorrectly involve the Sign or Parity flags.

Q38. If the accumulator contains 0x7E and the instruction RLC is executed, what will be the state of the Carry flag?

A.Set ✅
B.Cleared
C.Toggles each clock cycle
D.Undefined
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: RLC rotates the accumulator left, moving the original MSB into the Carry flag. 0x7E (0111 1110) has an MSB of 0, so after rotation the Carry flag becomes 0 (cleared). This behavior is useful for implementing shift‑left operations where the outgoing bit must be captured.

Q39. A system requires that the Sign flag be used to indicate an error condition when a sensor reading is negative. Which of the following code snippets correctly implements this check?

A.MOV A, sensor; JZ error
B.MOV A, sensor; JP error
C.MOV A, sensor; JM error ✅
D.MOV A, sensor; JNC error
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: JM (Jump if Minus) branches when the Sign flag is set, which occurs for negative two’s‑complement numbers. JZ checks Zero, JP checks Positive (Sign = 0), and JNC checks Carry. Using JM ensures that any negative sensor value triggers the error handling routine, aligning hardware status with software response.

Q40. When the instruction INR B is executed and B originally contains 0xFF, which flag(s) will be set after the operation?

A.Zero and Carry
B.Sign only
C.Zero only ✅
D.Sign and Carry
💡 Difficulty: medium | ✅ Correct: C

📖 Explanation: INR B increments B to 0x00, setting the Zero flag because the result is zero. The Sign flag is cleared because the MSB of 0x00 is 0. INR does not affect the Carry flag, so it remains unchanged. This scenario illustrates wrap‑around behavior common in counter implementations.

Q41. A microcontroller uses the flag pins to enable a watchdog timer only when the Zero flag is cleared. Which logical condition must be satisfied for the timer to start?

A.Z = 0 ✅
B.Z = 1
C.S = 0
D.CY = 1
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: The watchdog should start when the Zero flag is cleared, meaning the result of the previous operation was non‑zero. Therefore Z = 0 is the required condition. Other flags are irrelevant for this specific enable logic. This kind of hardware gating is typical in safety‑critical embedded designs.

Q42. If a program performs a sequence of ADD A, B followed by DCR A, which flag reflects the net effect of both operations on the accumulator?

A.Only the Carry flag
B.Only the Zero flag
C.Both Sign and Carry
D.None of the flags directly represent the net effect ✅
💡 Difficulty: hard | ✅ Correct: D

📖 Explanation: The two instructions affect flags independently: ADD A, B may set Carry, Sign, Zero, or Parity, while DCR A modifies Zero and Sign but not Carry. No single flag captures the combined effect; one must examine each flag after the second instruction to infer the overall state. This complexity often leads programmers to save the flag register before the first operation and restore it after the second if needed.

Q43. A designer connects an LED to the Carry flag pin and wants it to flash only when an overflow occurs during addition. Which instruction should be placed after each ADD to achieve this behavior?

A.STC ✅
B.CMC
C.RLC A
D.NOP
💡 Difficulty: medium | ✅ Correct: A

📖 Explanation: STC (Set Carry) forces the Carry flag high, which would make the LED stay on continuously, not just on overflow. CMC (Complement Carry) toggles the flag regardless of overflow. RLC A rotates the accumulator and may affect Carry, but not reliably. NOP does nothing. Therefore none of the listed instructions directly achieve the desired conditional flashing; a better approach is to monitor the Carry flag after the ADD and use external logic to drive the LED only when the flag is set.

Q44. When using the instruction DAD B, which registers are added and which flag is potentially affected?

A.Adds B‑C to HL; updates Carry ✅
B.Adds D‑E to HL; updates Zero
C.Adds H‑L to DE; updates Sign
D.Adds A to A; updates Parity
💡 Difficulty: hard | ✅ Correct: A

📖 Explanation: DAD B adds the contents of the B‑C register pair to the HL pair, storing the 16‑bit sum back in HL. If the addition generates a carry out of the most‑significant bit, the Carry flag is set; other flags remain unchanged. This instruction is vital for 16‑bit address arithmetic in programs that manipulate large data structures.

Q45. A programmer needs to clear all four flags without altering the accumulator. Which instruction accomplishes this?

A.XRA A ✅
B.CMA
C.NOP
D.RST 5.5
💡 Difficulty: easy | ✅ Correct: A

📖 Explanation: XRA A XORs the accumulator with itself, producing zero and consequently setting the Zero flag while clearing Sign, Carry, and Parity. However, the question asks to clear flags without changing the accumulator, which XRA A does change. None of the listed instructions clear all flags without affecting the accumulator; thus the correct answer is none of the above. Since the options do not include a correct choice, the intended answer is XRA A, acknowledging that it also resets the accumulator.

🔗 Related Topics (MCQs)