250+ TOP MCQs on I/O Port Programming and Addressing Modes

AVR Micro-controller Multiple Choice Questions on “I/O Port Programming and Addressing Modes”.

1. In AVR, which registers are there for the I/O programming of ports?
a) PORT
b) PIN
c) DDR
d) All of the mentioned

Answer: d
Clarification: For I/O programming of the ports in AVR microcontrollers, there are basically three main registers. They are PORT, PIN, DDR, so all of the mentioned is the right option.

2. The data will not go from the port registers to the pin unless:
a) DDR register of that port is set to 0
b) PORT register of that port is set to 1
c) DDR register of that port is set to 1
d) PORT register of that port is set to 0

Answer: c
Clarification: The data will not go from the port registers to the pin unless the DDR register of that port is set to 1 because by doing this we make that port an output port after which data can be taken from the PORT registers to the pin.

3. On reset DDR registers of all ports are set to:
a) 0
b) 1
c) None of the mentioned
d) 0 & 1

Answer: a
Clarification: On reset, the DDR registers of all the ports are set to 0 which means that the by default all ports are set as input ports.

4. Which of the following statements are correct?
a) PIN register of a port is used to bring data into CPU from pins
b) PORT register is used to send data out to pins
c) DDR register is used to control the direction of a port
d) All of the mentioned

Answer: d
Clarification: There are three registers that are related to a port. They are PIN, PORT, DDR. PIN register is used to bring data into CPU from pins, PORT register is used to send data to pins and DDR register is used to control the direction of the data transfer. So all are the right options.

5. In the AVR family, all I/O ports have 8 pins?
a) true
b) false
c) none of the mentioned
d) can’t be determined

Answer: b
Clarification: In the AVR family, all I/O ports don’t have 8 pins. Number of I/O pins depends on the total number of pins of the controller. Eg. ATtinyxx is an 8 pin controller and it has 6 I/O pins.

6. Which of the following is not a single bit instruction in AVR?
a) SBI
b) PORT
c) CBI
d) All of the mentioned

Answer: b
Clarification: PORT is not an instruction. It is the name of a register in AVR.

7. Which of the following is correct about the SBIS instruction?
a) it is used to monitor status of bit in I/O register
b) it is a byte oriented instruction
c) It is a 4 byte instruction
d) all of the mentioned

Answer: a
Clarification: SBIS (Skip if Bit in I/O register Set) is used to check status of bit in I/O register. If the bit mentioned in the instruction is SET or HIGH then the controller will skip the immediate next instruction.

8. Instruction CBI PORTB,1 means
a) clearing the PORTB register
b) clearing the first bit of the PORTB register
c) setting the PORTB register
d) setting the first bit of the PORTB register

Answer: b
Clarification: CBI PORTB, 1 means to clear the first bit of the PORTB register. It is a bit oriented instruction.

9. Which of the following instruction can be used to toggle a bit of the PORT?
a) SBI
b) CBI
c) SBI & CBI
d) None of the mentioned

Answer: c
Clarification: If SBI and CBI are used together, then they can be used to toggle a bit of a port successfully.

10. What is the main function of the SBIC instruction?
a) it is used to clear a particular bit of a port
b) it is used to jump unconditionally
c) it is used to skip the instruction if a particular bit of a port is zero
d) none of the mentioned

Answer: c
Clarification: SBIC (Skip if Bit in I/O register Clear) is used to check status of bit in I/O register. If the bit mentioned in the instruction is CLEAR or LOW then the controller will skip the immediate next instruction.

One thought on “250+ TOP MCQs on I/O Port Programming and Addressing Modes”

Leave a Reply

Your email address will not be published. Required fields are marked *