Engineering Questions with Answers - Multiple Choice Questions

MCQs on I/O Port Programming and Addressing Modes

1 - Question

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

View Answer

Answer: d
Explanation: 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 - Question

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

View Answer

Answer: c
Explanation: 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 - Question

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

View Answer

Answer: a
Explanation: 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 - Question

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

View Answer

Answer: d
Explanation: 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 - Question

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

View Answer

Answer: b
Explanation: 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 - Question

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

View Answer

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




7 - Question

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

View Answer

Answer: a
Explanation: 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 - Question

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

View Answer

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




9 - Question

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

View Answer

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




10 - Question

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

View Answer

Answer: c
Explanation: 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.

Get weekly updates about new MCQs and other posts by joining 18000+ community of active learners