8051 Microcontroller Questions and Answers – I/O Port Programming and Addressing Modes

This set of 8051 Micro-controller Multiple Choice Questions & Answers (MCQs) focuses on “I/O Port Programming and Addressing Modes”.

1. To initialize any port as an output port what value is to be given to it?
a) 0xFF
b) 0x00
c) 0x01
d) A port is by default an output port
View Answer

Answer: d
Explanation: In 8051, a port is initialized by default in its output mode no need to pass any value to it.

2. Which out of the four ports of 8051 needs a pull-up resistor for using it is as an input or an output port?
a) PORT 0
b) PORT 1
c) PORT 2
d) PORT 3
View Answer

Answer: a
Explanation: These pins are the open drain pins of the controller which means it needs a pull-up resistor for using it as an input or an output ports.

3. Which of the ports act as the 16 bit address lines for transferring data through it?
a) PORT 0 and PORT 1
b) PORT 1 and PORT 2
c) PORT 0 and PORT 2
d) PORT 1 and PORT 3
View Answer

Answer: c
Explanation: PORT 0 and PORT 2 are used as the 16 bit address lines where PORT0 act as lower bit address lines and PORT 2 as higher bit address lines.
advertisement
advertisement

4. Which of the following registers are not bit addressable?
a) SCON
b) PCON
c) A
d) PSW
View Answer

Answer: b
Explanation: PCON register is not a bit addressable register.

5. Which instruction is used to check the status of a single bit?
a) MOV A,P0
b) ADD A,#05H
c) JNB PO.0, label
d) CLR P0.05H
View Answer

Answer: c
Explanation: JNB which stands for Jump if no bit checks the status of the bit P0.0 and jumps if the bit is 0.
Note: Join free Sanfoundry classes at Telegram or Youtube

6. Which addressing mode is used in pushing or popping any element on or from the stack?
a) immediate
b) direct
c) indirect
d) register
View Answer

Answer: b
Explanation: If we want to push or pop any element on or from the stack then direct addressing mode has to be used in it, as the other way is not accepted.

7. Which operator is the most important while assigning any instruction as register indirect instruction?
a) $
b) #
c) @
d) &
View Answer

Answer: c
Explanation: In register, indirect mode data is copied at that location where R0 or R1 are present, so @ operator is used ex. MOV @R0,A
advertisement

8. What is the advantage of register indirect addressing mode?
a) it makes use of registers R0 and R1
b) it uses the data dynamically
c) it makes use of operator @
d) it is easy
View Answer

Answer: b
Explanation: Register indirect addressing mode is useful if a series of data is to be assigned to that address, with the help of this quality the number of instructions decreases as a result of which performance increases.

9. Which of the following comes under the indexed addressing mode?
a) MOVX A, @DPTR
b) MOVC @A+DPTR,A
c) MOV A,R0
d) MOV @R0,A
View Answer

Answer: b
Explanation: Indexed addressing mode stands for that instruction where the bits of the accumulator is also indexed with the 16 bit registers.
advertisement

10. Is this a valid statement?
SETB A
a) yes
b) no
c) cant be determined
d) none of the mentioned
View Answer

Answer: b
Explanation: SETB is used to set a bit of a register. A stands for accumulator which is an 8 bit register, so it is an invalid instruction.

Sanfoundry Global Education & Learning Series – Microcontroller.

To practice all areas of Microcontroller, here is complete set of 1000+ Multiple Choice Questions and Answers.

If you find a mistake in question / option / answer, kindly take a screenshot and email to [email protected]

advertisement
advertisement
Subscribe to our Newsletters (Subject-wise). Participate in the Sanfoundry Certification contest to get free Certificate of Merit. Join our social networks below and stay updated with latest contests, videos, internships and jobs!

Youtube | Telegram | LinkedIn | Instagram | Facebook | Twitter | Pinterest
Manish Bhojasia - Founder & CTO at Sanfoundry
Manish Bhojasia, a technology veteran with 20+ years @ Cisco & Wipro, is Founder and CTO at Sanfoundry. He lives in Bangalore, and focuses on development of Linux Kernel, SAN Technologies, Advanced C, Data Structures & Alogrithms. Stay connected with him at LinkedIn.

Subscribe to his free Masterclasses at Youtube & discussions at Telegram SanfoundryClasses.