Download as pdf or txt
Download as pdf or txt
You are on page 1of 34

1. What is a microcontroller?

a) A computer system with many elements

b) A microprocessor system with additional features built for a specific task

c) A system with only a Central Processing Unit (CPU)

d) A system with only Read-only Memory (ROM)

e) A system with only Input/Output Module (IO)

Answer: b) A microcontroller is a microprocessor system with additional features built for a specific
task. It is integrated altogether into one single chip.

Explanation: A microcontroller is a smaller version of a microprocessor system with additional features


built for a specific task. It is integrated altogether into one single chip. Some examples of
microcontroller applications are robots, calculators, traffic lights, security systems, washing machines,
electronic billboards, microwave ovens, etc.

2. What are the elements of a microprocessor system?

a) Central Processing Unit (CPU), Storage Elements, and Input/Output Module (IO)

b) Central Processing Unit (CPU), Storage Elements, and Serial/Parallel Communication Ports

c) Central Processing Unit (CPU), Storage Elements, and Timer/Interrupt Modules

d) Central Processing Unit (CPU), Storage Elements, and Read-only Memory (ROM)

e) Central Processing Unit (CPU), Storage Elements, and Random Access Memory (RAM)

Answer: e) Central Processing Unit (CPU), Storage Elements, and Random Access Memory (RAM)

Explanation: A microprocessor system is a computer system that comprises many elements, including
a Central Processing Unit (CPU), Storage Elements, such as Read-only Memory (ROM) and Random
Access Memory (RAM), Input/Output Module (IO), Serial/Parallel Communication Ports, and
Timer/Interrupt Modules.

ware that runs on the microprocessor

•The software is typically burned into ROM or flash memory

•The microprocessor is typically chosen based on the specific requirements of the application

1. Which of the following is a characteristic of a microprocessor system?

a) No I/O ports

b) Timer
c) ADC

d) RAM

e) ROM

Answer: d) RAM

Explanation: A microprocessor system includes a CPU (microprocessor) but does not have any RAM,
ROM, or I/O ports. These components must be added externally to make the system functional.

2. What is the advantage of using a microcontroller over a general-purpose microprocessor?

a) More computing power

b) More versatility in RAM, ROM, and I/O ports

c) Lower cost

d) Smaller size

e) None of the above

Answer: d) Smaller size

Explanation: Microcontrollers have a fixed amount of on-chip ROM, RAM, and number of I/O ports,
which makes them ideal for many applications in which cost and space are critical considerations. In
contrast, general-purpose microprocessors require external components to be added, which can make
the system bulkier and more expensive.

3. What is an embedded product?

a) A product that uses a microprocessor to do multiple tasks

b) A product that uses a microcontroller to do one task only

c) A product that uses a general-purpose microprocessor

d) A product that has no software

e) A product that has no microprocessor

Answer: b) A product that uses a microcontroller to do one task only

Explanation: An embedded product uses a microprocessor (or microcontroller) to do one task and one
task only. The software is typically burned into ROM or flash memory, and the microprocessor is
chosen based on the specific requirements of the application.

al, Binary, Octal, and Hexadecimal are examples of:

A) Microprocessors
B) Embedded products

C) Pre-learned topics

D) RAM memory

E) Peripheral devices

Answer: C) Pre-learned topics

Explanation: The content states that "Some knowledge obtained prior undertaking this subject include
Numbering systems, Binary / Octal / Hexadecimal numbers, Decimal to binary / octal / hexadecimal
conversions, Binary data – sign & magnitude, Standard Data codes –Gray, ASCII & EBCDIC,
Combinational Logic Circuits and its operations, Adder, decoder, multiplexer, Electronic operating
characteristics, Input switch, keypad matrix, Common anode / cathode LEDs, 7 segment display."
These are all examples of pre-learned topics.

2. An embedded product typically has:

A) Multiple application software

B) A microprocessor and a microcontroller

C) RAM memory and an operating system

D) A variety of applications loaded into ROM

E) One application software burned into ROM

Answer: E) One application software burned into ROM

Explanation: The content states that "An embedded product uses a microprocessor (or microcontroller)
to do one task and one task only. There is only one application software that is typically burned into
ROM." Therefore, an embedded product typically has one application software burned into ROM.

3. What is the main difference between an embedded system and a PC?

A) An embedded system has RAM memory and an operating system

B) A PC can only be used for one application

C) An embedded system contains various embedded products

D) An embedded system uses a microprocessor and a microcontroller

E) A PC can be used for any number of applications

Answer: E) A PC can be used for any number of applications

Explanation: The content states that "A PC, in contrast with the embedded system, can be used for any
number of applications." Therefore, the main difference between an embedded system and a PC is that
a PC can be used for any number of applications.
4. What is the purpose of a microcontroller in a peripheral device?

A) To perform only one task

B) To load a variety of applications into RAM

C) To contain an operating system

D) To be connected to a PC

E) To have multiple application software

Answer: A) To perform only one task

Explanation: The content states that "Each one peripheral has a microcontroller inside it that performs
only one task." Therefore, the purpose of a microcontroller in a peripheral device is to perform only one
task.

5. Which microcontroller is discussed in Chapter 1.4?

A) Intel 8051 Microcontroller

B) Microprocessor and microcontroller

C) Processor Architectural Concept

D) Pre-learned topics

E) None of the above

Answer: A) Intel 8051 Microcontroller

Explanation: The content states that "Chapter 1.4 discusses the Intel 8051 Microcontroller." Therefore,
the microcontroller discussed in Chapter 1.4 is the Intel 8051 Microcontroller.

1. Which of the following is used to control the input in a circuit?

a) Output switch

b) Input switch

c) Keypad matrix

d) Common anode LEDs

e) Common cathode LEDs

Answer: b) Input switch

Explanation: An input switch is used to control the input in a circuit.


2. Which of the following is used to display numbers in a circuit?

a) Input switch

b) Keypad matrix

c) Common anode LEDs

d) Common cathode LEDs

e) 7 segment display

Answer: e) 7 segment display

Explanation: A 7 segment display is used to display numbers in a circuit.

3. Which of the following numbering systems is used to represent the number 13?

a) Decimal

b) Binary

c) Octal

d) Hexadecimal

e) None of the above

Answer: d) Hexadecimal

Explanation: In the hexadecimal numbering system, the number 13 is represented as D.

4. Which of the following is used to represent negative numbers in binary data?

a) Signed number representation

b) Magnitude representation

c) Bit

d) Nibble

e) Byte

Answer: a) Signed number representation

Explanation: Signed number representation is used to represent negative numbers in binary data.

5. Which of the following data codes is used to represent characters with unique binary data values?

a) Gray Code
b) ASCII Code

c) EBCDIC Code

d) Reflective Code

e) None of the above

Answer: b) ASCII Code

Explanation: ASCII Code is used to represent characters with unique binary data values.

ALU) – performs arithmetic and logical operations

3.Control Unit – manages the flow of data and instructions

4.Memory – stores data and instructions for processing

1. What is EBCDIC Code?

A. A code used by Microsoft systems

B. A code used by Apple systems

C. A code used by IBM systems

D. A code used by Linux systems

E. A code used by Android systems

Answer: C. A code used by IBM systems.

Explanation: EBCDIC stands for Extended Binary Coded Decimal Interchange Code and is widely used
by IBM systems. It is 8 bits wide and each character has its own unique binary data value.

2. What is the width of the binary data value for characters in EBCDIC Code?

A. 4 bits

B. 5 bits

C. 6 bits

D. 7 bits

E. 8 bits

Answer: E. 8 bits.

Explanation: The binary data value for characters in EBCDIC Code is 8 bits wide.
3. What are HALF ADDER and FULL ADDER?

A. Types of switches

B. Types of displays

C. Types of encoders

D. Types of decoders

E. Types of combinational logic systems

Answer: E. Types of combinational logic systems.

Explanation: HALF ADDER and FULL ADDER are types of combinational logic systems.

4. What is a Keypad Matrix?

A. A type of display

B. A type of switch

C. A type of encoder

D. A type of decoder

E. A type of electronic operating characteristic

Answer: E. A type of electronic operating characteristic.

Explanation: Keypad Matrix is a type of electronic operating characteristic.

5. What are the four digital components that a processor can be built on?

A. Registers, ALU, Control Unit, and Memory

B. Registers, ALU, Control Unit, and Display

C. Registers, ALU, Memory, and Switches

D. Registers, ALU, Memory, and Keypad

E. Registers, ALU, Display, and Keypad

Answer: A. Registers, ALU, Control Unit, and Memory.

Explanation: The four digital components that a processor can be built on are Registers, ALU, Control
Unit, and Memory.

o another
1. Which of the following is NOT a digital component of a processor?

a) Registers

b) Arithmetic Logic Unit (ALU)

c) Control Unit (CU)

d) Internal Interconnections

e) All of the above are digital components

Answer: e) All of the above are digital components.

Explanation: A processor is built on four digital components, which are Registers, ALU, CU, and
Internal Interconnections. Therefore, all of the above options are digital components of a processor.

2. What is the function of the Program Counter (PC) register?

a) It stores the resulting data of ALU operations.

b) It contains control bits for a processor.

c) It points to the memory address location of a program code due to be fetched.

d) It provides communication between registers, ALU, and CU.

e) None of the above.

Answer: c) It points to the memory address location of a program code due to be fetched.

Explanation: The Program Counter (PC) register is a type of register that points to the memory address
location of a program code due to be fetched. The PC value usually begins at 00H upon power-up or
reset.

3. Which register is the main register for storing ALU resulting data?

a) Program Counter (PC)

b) General Purpose Registers

c) Accumulator (ACC)

d) Program Status Word (PSW)

e) None of the above.

Answer: c) Accumulator (ACC)

Explanation: The Accumulator (ACC) register is the main register for storing ALU resulting data. It can
perform operations such as shift, rotate, add, subtract, and invert.

4. What is the function of the Program Status Word (PSW) register?


a) It stores the resulting data of ALU operations.

b) It contains control bits for a processor.

c) It points to the memory address location of a program code due to be fetched.

d) It provides communication between registers, ALU, and CU.

e) It contains flag signals of the Accumulator status such as Zero, Parity, Overflow, Sign, etc.

Answer: e) It contains flag signals of the Accumulator status such as Zero, Parity, Overflow, Sign, etc.

Explanation: The Program Status Word (PSW) register is a register that contains control bits for a
processor and flag signals of the Accumulator status such as Zero, Parity, Overflow, Sign, etc. The bit
representation may differ from one processor to another.

1. What is the purpose of the PSW register in the processor's Arithmetic Logic Unit?

a) To store the specific address for stacking data

b) To perform arithmetic operations such as addition, subtraction, multiplication and division

c) To perform logic operations such as AND, OR, XOR

d) To perform shift operations such as rotate, shift and swap

e) To store status signals generated by the ALU operations

Answer: e) To store status signals generated by the ALU operations. The PSW register stores the flag
signals of the Accumulator status such as Zero, Parity, Overflow, Sign etc.

2. What is the function of the Stack Pointer (SP) register in the processor?

a) To store the specific address for stacking data

b) To perform arithmetic operations such as addition, subtraction, multiplication and division

c) To perform logic operations such as AND, OR, XOR

d) To perform shift operations such as rotate, shift and swap

e) To direct the processor's operation and tell the memory, ALU and I/O peripherals on how to respond
to a certain program instruction.

Answer: a) To store the specific address for stacking data. The Stack Pointer (SP) register stores the
specific address for stacking data and updates a new pointer address every time an address is used for
stack.

3. What is the function of the Control Unit in the processor?


a) To store the specific address for stacking data

b) To perform arithmetic operations such as addition, subtraction, multiplication and division

c) To perform logic operations such as AND, OR, XOR

d) To perform shift operations such as rotate, shift and swap

e) To direct the processor's operation and tell the memory, ALU and I/O peripherals on how to respond
to a certain program instruction.

Answer: e) To direct the processor's operation and tell the memory, ALU and I/O peripherals on how to
respond to a certain program instruction. The Control Unit is the brain for the processor where it directs
the processor's operation and tells the memory, ALU and I/O peripherals on how to respond to a certain
program instruction. It consists of multiple levels of sequences and events that will interpret the
program code and transmit and receive control signals throughout the processor.

a Last-In-First-Out (LIFO) data structure, where the last data item pushed onto the stack is the first one
to be popped off.

•The stack pointer (SP) register is used to keep track of the current top of the stack.

•When a subroutine or interrupt program is executed, the processor pushes the current program
counter (PC) value onto the stack, so that it can be retrieved later.

•The processor then jumps to the subroutine or interrupt program, and executes it.

•When the subroutine or interrupt program is finished, the processor pops the previous PC value from
the stack, and resumes execution from that point.

A. What is the function of the program counter (PC) register in a processor?

1. To store important data temporarily

2. To keep track of the current top of the stack

3. To point the memory address location for the processor to fetch instructions

4. To execute the program instructions in binary

5. To retrieve the previous PC value from the stack

Answer: 3. To point the memory address location for the processor to fetch instructions. The program
counter (PC) register is used to keep track of the memory address location for the processor to fetch
instructions.

B. What is the purpose of the stack in a processor or microcontroller?

1. To execute the program instructions in binary

2. To store important data temporarily


3. To keep track of the current top of the stack

4. To retrieve the previous PC value from the stack

5. To push the current PC value onto the stack

Answer: 2. To store important data temporarily. The stack is used to temporarily store important data
when a subroutine or interrupt program is executed.

ectural Concept

1. What is the purpose of the stack in microcontrollers?

a) To store input features

b) To store output features

c) To store temporary data processing

d) To store program code

e) None of the above

Answer: c) To store temporary data processing. The stack operates as a reserved area to store current
important values such as program counter, accumulator, program status word and others.

2. What does the value shown by the stack pointer register represent?

a) The address in the ROM

b) The address in the EEPROM

c) The address in the RAM

d) The address in the flash memory

e) None of the above

Answer: c) The address in the RAM. The value shown by the stack pointer register represent the
address in the RAM.

3. What is the concept used by the stack when storing and retrieving data?

a) First In First Out

b) Last In First Out

c) Random Access

d) Sequential Access
e) None of the above

Answer: b) Last In First Out. The stacking operation uses the Last In First Out concept.

4. Which of the following is NOT a key factor that a microcontroller should have?

a) Input feature

b) Output feature

c) Timer/delay feature

d) Non-volatile memory feature

e) All of the above are key factors

Answer: e) All of the above are key factors. A microcontroller should have the ability to detect or sense
the surrounding – input feature, provide a certain amount of response – output feature, exploit the
response frequency – timer/delay feature, provide prioritize response – interrupt feature, contain
storage for program – non-volatile memory feature, and contain storage for temporary data processing
– RAM feature.

5. What additional feature may be taken into consideration for a microcontroller?

a) ADC/DAC module

b) IP module

c) GSM module

d) All of the above

e) None of the above

Answer: d) All of the above. Apart from key elements, additional features may be taken into
consideration such as ADC/DAC module, IP module, and GSM module.

1. Which of the following additional features may be taken into consideration along with the key
elements mentioned above?

A) Bluetooth module

B) ADC/DAC module

C) Wi-Fi module

D) NFC module

E) GPS module
Answer: B) ADC/DAC module

Explanation: Along with the key elements mentioned above, additional features such as ADC/DAC
module may be taken into consideration.

2. Which of the following microcontrollers is based on Intel 8080 architecture?

A) MC6811 from Motorola

B) MCS-51 from Intel

C) Z80 from Zilog

D) PIC from Microchip

E) AVR from Atmel

Answer: C) Z80 from Zilog

Explanation: Z80 from Zilog is an 8-bit microcontroller based on Intel 8080 architecture.

3. Which of the following microcontrollers has the most powerful features?

A) MC6811 from Motorola

B) MCS-51 from Intel

C) Z80 from Zilog

D) PIC from Microchip

E) AVR from Atmel

Answer: A) MC6811 from Motorola

Explanation: MC6811 from Motorola has built-in EEPROM and RAM, digital I/O, timer, ADC, and
RS232, making it the most powerful microcontroller among the given options.

4. Which of the following microcontrollers is currently the most widely used?

A) MC6811 from Motorola

B) MCS-51 from Intel

C) Z80 from Zilog

D) PIC from Microchip

E) AVR from Atmel

Answer: B) MCS-51 from Intel


Explanation: MCS-51 from Intel is currently the most widely used microcontroller, supported by many
design manufacturers.

5. Which of the following is a type of memory in the 8051 microcontroller?

A) Flash memory

B) SRAM

C) DRAM

D) ROM

E) Cache memory

Answer: D) ROM

Explanation: The 8051 microcontroller has two types of memory, program memory (ROM) and data
memory (RAM).

1. Which instruction is used for 8-bit addition between the accumulator, a second operand, and the
previous value of the CY flag?

a) DA

b) SUBB

c) OADDC

d) MOV

e) ADD

Answer: c) OADDC

Explanation: OADDC is used for 8-bit addition between the accumulator, a second operand, and the
previous value of the CY flag. It is useful for 16-bit addition in two steps, and the CY flag is set/reset
appropriately.

2. Which instruction is used to format the accumulator into a proper 2 digit packed BCD number?

a) DA

b) SUBB

c) OADDC

d) MOV

e) ADD
Answer: a) DA

Explanation: DA is used to format the accumulator into a proper 2 digit packed BCD number. It
operates only on the accumulator. If the lower nibble is greater than 9, the A flag is set to 1 and 6 is
added to the lower nibble. If the upper nibble is greater than 9, the C flag is set to 1 and 6 is added to
the upper nibble.

3. Which instruction is used to subtract an operand and the previous value of the borrow (carry) flag
from the accumulator?

a) DA

b) SUBB

c) OADDC

d) MOV

e) ADD

Answer: b) SUBB

Explanation: SUBB is used to subtract an operand and the previous value of the borrow (carry) flag
from the accumulator. The result is always saved in the accumulator, and the CY flag is set/reset
appropriately. Subtraction uses adder circuitry.

Note: The example given for SUBB in the content is incorrect. The correct example should be:

MOV A,#3FH ; A = 3FH

MOV R3,#23H ; R3 = 23H

SUBB A,R3 ; A = A-R3-CY, A= 3FH-23H-0, A=1CH

a) What is the result of SUBB A,R3?

1) A = 23H

2) A = 1CH

3) A = 3FH

4) A = 20H

5) A = 21H

Answer: 2) A = 1CH

Explanation: SUBB subtracts the second operand from the first operand and subtracts the carry flag.
Here, A is subtracted by R3 (23H) and the result is stored in A. A = A - R3 - CY. As CY is not set, it is
considered as 0. Therefore, A = 3FH - 23H - 0 = 1CH.
b) What is the purpose of the OINC instruction?

1) Decrement the operand by one

2) Multiply A by B and place result in A and B

3) Increment the operand by one

4) Divide A and B and place result in A and B

5) None of the above

Answer: 3) Increment the operand by one

Explanation: OINC instruction increments the operand by one. The operand can be a register, a direct
address, an indirect address, or the data pointer.

c) What is the result of OMUL AB if A = 25H and B = 65H?

1) A = 99H, B = 0EH

2) A = 0EH, B = 99H

3) A = 99H, B = 99H

4) A = 0EH, B = 0EH

5) None of the above

Answer: 1) A = 99H, B = 0EH

Explanation: OMUL AB multiplies A by B and places the result in A (lower byte) and B (higher byte).
The product has 16 bits. Here, A = 25H and B = 65H. Therefore, A * B = 25H * 65H = E99H. The lower
byte of the product is 99H and the higher byte is 0EH.

d) What is the result of ODIV AB if A = 95 and B = 10?

1) A = 9, B = 5

2) A = 5, B = 9

3) A = 10, B = 95

4) A = 95, B = 10

5) None of the above

Answer: 1) A = 9, B = 5

Explanation: ODIV AB divides A (numerator) by B (denominator) and places the result in A (quotient)
and B (remainder). The product has 16 bits. Here, A = 95 and B = 10. Therefore, A / B = 9 with a
remainder of 5. Hence, A = 9 and B = 5.
e) What is the purpose of taking 2's complement of the source operand?

1) To add to A

2) To invert the carry

3) To subtract from A

4) To multiply A by B

5) None of the above

Answer: 3) To subtract from A

Explanation: Taking 2's complement of the source operand is used to perform subtraction. It is done by
inverting all the bits of the source operand and adding 1 to it. The result is then added to the destination
operand to perform subtraction.

1. What is the value of B after the instruction "MOV B,#10; B=10"?

a) 5

b) 9

c) 10

d) 15

e) None of the above

Answer: c) 10. Explanation: The instruction "MOV B,#10" moves the value 10 to register B.

2. What is the value of A and B after the instruction "O DIV AB; A=9, B=5"?

a) A=9, B=5

b) A=5, B=9

c) A=1, B=4

d) A=4, B=1

e) None of the above

Answer: a) A=9, B=5. Explanation: The instruction "O DIV AB" divides register A by register B and
stores the quotient in A and the remainder in B.

3. What is the value of CY, AC, and P flag after the addition of 9CH and 64H in the following
instructions?
MOV A, #9CH

ADD A, #64H

a) CY=0, AC=1, P=0

b) CY=1, AC=0, P=1

c) CY=0, AC=0, P=1

d) CY=1, AC=1, P=0

e) None of the above

Answer: c) CY=0, AC=0, P=1. Explanation: The addition of 9CH and 64H results in the value A=00H
and CY=0. The AC flag is not affected by this operation. The accumulator has an even number of 1s,
so P=1.

4. Which logical operation has no effect on flag?

a) ANL

b) ORL

c) XRL

d) CPL

e) CLR

Answer: b) ORL. Explanation: The logical operation ORL has no effect on the flag.

5. Which logical operation works on byte-sized operands or the CY flag?

a) ANL

b) ORL

c) XRL

d) CPL

e) CLR

Answer: a) ANL. Explanation: The logical operation ANL works on byte-sized operands or the CY flag.

lower nibbles of the accumulator

•OSWAP A

–MOV A,#9AH ; A = 1001 1010


–OSWAP A; A = 1010 1001

MSB LSB

MSB LSB Logical Operations

1. What is the result of the ANL operation on the value 35H and OFH?

a) 30H

b) 05H

c) 3FH

d) 00H

e) 01H

Answer: b) 05H. The ANL operation performs a bitwise AND between the two values, resulting in A =
35H AND 0FH, which is equal to 05H.

2. What is the result of the ORL operation on the value 04H and 30H?

a) 34H

b) 3CH

c) 00H

d) 3EH

e) 04H

Answer: a) 34H. The ORL operation performs a bitwise OR between the two values, resulting in A =
04H OR 30H, which is equal to 34H.

3. What is the result of the XRL operation on the value 54H and 78H?

a) 2CH

b) 24H

c) 7CH

d) 50H

e) 28H

Answer: a) 2CH. The XRL operation performs a bitwise XOR between the two values, resulting in A =
54H XOR 78H, which is equal to 2CH.

4. What is the purpose of the OCPL instruction?


a) To complement the value of a bit or the accumulator

b) To clear the value of a bit or the accumulator

c) To rotate the value of the accumulator

d) To swap the upper and lower nibbles of the accumulator

e) None of the above

Answer: a) To complement the value of a bit or the accumulator. The OCPL instruction is used to
complement the value of a bit or the accumulator.

5. What is the result of the RL operation on the value 72H?

a) 39H

b) E4H

c) 1CH

d) 38H

e) 74H

Answer: b) E4H. The RL operation performs a bitwise rotation to the left on the accumulator, resulting
in A = 72H rotated to the left, which is equal to E4H.

6. What is the result of the RRC operation on the value 26H?

a) 13H, CY = 0

b) 09H, CY = 1

c) 33H, CY = 0

d) 19H, CY = 1

e) 26H, CY = 0

Answer: b) 09H, CY = 1. The RRC operation performs a bitwise rotation to the right through the carry
on the accumulator, resulting in A = 26H rotated to the right through the carry, which is equal to 09H,
with the carry flag set to 1.

7. What is the result of the OSWAP operation on the value 9AH?

a) 9AH

b) A9H

c) 6CH
d) 96H

e) 69H

Answer: b) A9H. The OSWAP operation swaps the upper and lower nibbles of the accumulator,
resulting in A = 9AH swapped, which is equal to A9H.

1. What is the result of the instruction "RRC A; A = 1010 1011, CY = 0"?

a) A = 0101 0101, CY = 1

b) A = 0101 0110, CY = 1

c) A = 1010 1011, CY = 0

d) A = 1010 1010, CY = 1

e) A = 1010 1010, CY = 0

Answer: b) A = 0101 0110, CY = 1

Explanation: The RRC instruction rotates the bits of A to the right by one position, and the bit that is
shifted out is stored in the CY flag. In this case, A = 1010 1011 is rotated to the right to become A =
0101 0101, and the CY flag is set to 1. Then, the value of A is updated to A = 0101 0110, with the CY
flag still set to 1.

2. What is the result of the instruction "OSWAP A; A = 27H"?

a) A = 72H

b) A = 27H

c) A = 2H

d) A = 7H

e) A = 72H, but with the upper and lower nibbles swapped

Answer: e) A = 72H, but with the upper and lower nibbles swapped

Explanation: The OSWAP instruction swaps the upper and lower nibbles of the accumulator. In this
case, the initial value of A is 27H, which has the nibbles 2 and 7. After the OSWAP instruction, the
value of A becomes 72H, with the nibbles swapped.

3. Which of the following instructions is used to push data onto the stack?

a) OMOV

b) OMOVC

c) OPUSH
d) OPOP

e) OXCH

Answer: c) OPUSH

Explanation: The OPUSH instruction is used to push data onto the stack. The stack is a region of
memory used for temporary storage of data during subroutine calls and interrupts. The data is pushed
onto the stack in Last-In-First-Out (LIFO) order.

4. Which of the following instructions is used to exchange low-order data?

a) OMOV

b) OMOVC

c) OPUSH

d) OPOP

e) OXCHD

Answer: e) OXCHD

Explanation: The OXCHD instruction is used to exchange the low-order nibble of the accumulator with
the contents of a memory location. This instruction is useful for operations involving binary-coded
decimal (BCD) arithmetic.

5. Which of the following instructions is used to load the accumulator with a byte from program
memory?

a) OMOV

b) OMOVC

c) OMOVX

d) OMOV C, bit

e) OMOV DPTR, #data

Answer: b) OMOVC

Explanation: The OMOVC instruction is used to load the accumulator with a byte from program
memory. This instruction is commonly used for accessing data elements of look-up tables stored in
program memory. The address of the byte to be loaded is specified using the PC (program counter)
and the instruction pointer.

1. Which instruction is used to load the accumulator with a byte from program memory?
a) OMOVC A, @A+DPTR

b) OMOVC A, @A+PC

c) OMOVX A, @Ri

d) XCH A, direct

e) PUSH

Answer: b) OMOVC A, @A+PC

Explanation: The instruction OMOVC A, @A+PC is used to load the accumulator with a byte from
program memory.

2. Which instruction is used for data transfer between the accumulator and a byte from external data
memory?

a) OMOVC A, @A+DPTR

b) OMOVX A, @DPTR

c) XCH A, Rn

d) PUSH

e) OMOVX A, @Ri

Answer: b) OMOVX A, @DPTR

Explanation: The instruction OMOVX A, @DPTR is used for data transfer between the accumulator and
a byte from external data memory.

3. Which instruction is used to exchange the accumulator and a byte variable?

a) XCH A, Rn

b) XCH A, direct

c) OMOVX A, @Ri

d) XCHD A, @Ri

e) PUSH

Answer: a) XCH A, Rn

Explanation: The instruction XCH A, Rn is used to exchange the accumulator and a byte variable.

4. What is the purpose of the PUSH/POP instruction?

a) To exchange the accumulator and a byte variable


b) To load the accumulator with a byte from program memory

c) To transfer data between the accumulator and external data memory

d) To increment/decrement the stack pointer and copy a byte into/from the stack

e) To exchange the lower digit of the accumulator with the lower digit of a memory location

Answer: d) To increment/decrement the stack pointer and copy a byte into/from the stack

Explanation: The PUSH/POP instruction is used to increment/decrement the stack pointer and copy a
byte into/from the stack.

5. Which instruction is used to exchange the lower digit of the accumulator with the lower digit of a
memory location identified indirectly by the index register?

a) XCH A, Rn

b) XCH A, direct

c) OMOVX A, @Ri

d) XCHD A, @Ri

e) PUSH

Answer: d) XCHD A, @Ri

Explanation: The instruction XCHD A, @Ri is used to exchange the lower digit of the accumulator with
the lower digit of a memory location identified indirectly by the index register.

JNC

Which of the following is true about the accumulator and internal memory location exchange in the
8051 microcontroller?

A. The upper 4-bits of each are modified.

B. The lower 4-bits of each are modified.

C. Both upper and lower 4-bits of each are modified.

D. None of the above.

Answer: B. The lower 4-bits of each are modified. This is because only the lower 4-bits of the internal
memory location identified indirectly by the index register are exchanged with the accumulator.

Which of the following flags cannot be directly altered by the Boolean Operations group of instructions
in the 8051 microcontroller?

A. P flag
B. OV flag

C. AC flag

D. CY flag

Answer: A. P flag. The P, OV, and AC flags cannot be directly altered by the Boolean Operations group
of instructions in the 8051 microcontroller.

What does the SETB instruction do in the 8051 microcontroller?

A. Clear a bit or the CY flag.

B. Complement a bit or the CY flag.

C. Set a bit or the CY flag.

D. OR a bit with the CY flag.

Answer: C. Set a bit or the CY flag. The SETB instruction is used to set a bit or the CY flag in the 8051
microcontroller.

What does the CPL instruction do in the 8051 microcontroller?

A. Clear a bit or the CY flag.

B. Complement a bit or the CY flag.

C. Set a bit or the CY flag.

D. AND a bit with the CY flag.

Answer: B. Complement a bit or the CY flag. The CPL instruction is used to complement a bit or the CY
flag in the 8051 microcontroller.

Which of the following instructions is used for data transfer between a bit and the CY flag in the 8051
microcontroller?

A. ORL

B. ANL

C. MOV

D. JNC

Answer: C. MOV. The MOV instruction is used for data transfer between a bit and the CY flag in the
8051 microcontroller.

What does the instruction "MOV C, 3FH" do?


A) Copies the CY flag to bit 3F of the bit addressable memory

B) Copies the CY flag to bit 2 of P1

C) Jumps to a relative address if CY is set

D) Jumps to a relative address if a bit is set

E) None of the above

Answer: A) Copies the CY flag to bit 3F of the bit addressable memory. This instruction moves the
value 3FH into the accumulator and then copies the CY flag to bit 3F of the bit addressable memory.

2. What is the purpose of the OJC/JNC instruction?

A) Jump to a relative address if CY is set/cleared

B) Jump to a relative address if a bit is set/cleared

C) Jump to a relative address if a bit is set and clear the bit

D) Execute different flows of program according to different input situations

E) None of the above

Answer: A) Jump to a relative address if CY is set/cleared. The OJC/JNC instruction allows the
program to jump to a relative address if the carry flag (CY) is set or cleared.

3. What is the difference between OJB and JNB instructions?

A) OJB jumps to a relative address if a bit is set, while JNB jumps to a relative address if a bit is cleared

B) OJB jumps to a relative address if a bit is cleared, while JNB jumps to a relative address if a bit is set

C) OJB jumps to a relative address if a bit is set and clears the bit, while JNB jumps to a relative
address if a bit is set

D) OJB jumps to a relative address if a bit is set, while JNB jumps to a relative address if a bit is set

E) None of the above

Answer: A) OJB jumps to a relative address if a bit is set, while JNB jumps to a relative address if a bit
is cleared. The OJB/JNB instructions allow the program to jump to a relative address if a bit is set or
cleared.

4. What is the purpose of the unconditional branching instructions?

A) To execute different flows of program according to different input situations

B) To break the program execution

C) To allow jumping to a relative address if a bit is set/cleared


D) To allow jumping to any memory location

E) None of the above

Answer: D) To allow jumping to any memory location. The unconditional branching instructions allow
the program to jump to any memory location without any condition.

5. Which of the following is an example of unconditional branching instruction?

A) OJC

B) OJB

C) LJMP

D) JNB

E) None of the above

Answer: C) LJMP. LJMP is an example of an unconditional branching instruction that allows the
program to jump to a 16-bit address of the target location.

. What is the maximum memory location that can be jumped to using unconditional branching in the
8051 microcontroller?

a) 1000H

b) FFFFH

c) 2000H

d) 8000H

e) 5000H

Answer: b) FFFFH

Explanation: The 8051 microcontroller can jump to any memory location between 0000H and FFFFH
using unconditional branching.

2. Which of the following is an example of an absolute jump instruction in the 8051 microcontroller?

a) JMP

b) ACALL

c) LCALL

d) AJMP
e) None of the above

Answer: d) AJMP

Explanation: AJMP is an absolute jump instruction in the 8051 microcontroller. It uses an 11-bit address
and is a 2-byte instruction.

3. What happens when an absolute jump instruction is executed in the 8051 microcontroller?

a) The high-order 5 bits in the PC are replaced with the destination address.

b) The low-order 11 bits in the PC are replaced with the destination address.

c) Both the high-order 5 bits and the low-order 11 bits in the PC are replaced with the destination
address.

d) The destination address is stored in the stack.

e) None of the above.

Answer: b) The low-order 11 bits in the PC are replaced with the destination address.

Explanation: When an absolute jump instruction is executed in the 8051 microcontroller, the low-order
11 bits in the PC are replaced with the destination address. The high-order 5 bits in the PC stay the
same.

4. Which of the following is an example of a subroutine instruction in the 8051 microcontroller?

a) JMP

b) ACALL

c) LCALL

d) AJMP

e) None of the above

Answer: b) ACALL

Explanation: ACALL is a subroutine instruction in the 8051 microcontroller. It uses an 11-bit address
and is used to call a subroutine within the same 2K byte.

5. What is the purpose of a subroutine in the 8051 microcontroller?

a) To perform tasks that need to be performed frequently.

b) To make the program more structured and save memory space.

c) To provide a way to call the same subroutine from multiple places in the program.

d) All of the above.


e) None of the above.

Answer: d) All of the above.

Explanation: A subroutine in the 8051 microcontroller is used to perform tasks that need to be
performed frequently, make the program more structured and save memory space, and provide a way
to call the same subroutine from multiple places in the program. After executing the subroutine, the
program will return to the original location where the subroutine was called.

Which subroutine instruction pushes the 16-bit address of the next instruction on the stack and updates
the stack pointer?

A) Absolute Call – ACALL

B) Long Call – LCALL

C) Return from subroutine – RET

D) Return from ISR (Interrupt Service Routine) – RETI

E) None of the above

Answer: A and B. Both Absolute Call – ACALL and Long Call – LCALL push the 16-bit address of the
next instruction on the stack and update the stack pointer.

Which return instruction pops the return address from the stack and continues execution there?

A) Return from subroutine – RET

B) Return from ISR (Interrupt Service Routine) – RETI

C) Both A and B

D) Neither A nor B

E) None of the above

Answer: A. Return from subroutine – RET pops the return address from the stack and continues
execution there.

Which conditional jump instruction jumps only if A is zero?

A) jz

B) jnz

C) djnz

D) All of the above

E) None of the above


Answer: A. jz jumps only if A is zero.

What is the maximum distance a subroutine can be located from the main program when using Long
Call – LCALL?

A) 2K byte

B) 64K byte

C) 11-bit address

D) 16-bit address

E) None of the above

Answer: B. Long Call – LCALL allows the subroutine to be located anywhere within 64K byte address.

1. What is the purpose of the jz and jnz instructions in the 8051 microcontroller?

a) To perform arithmetic operations

b) To check if a register is zero and jump accordingly

c) To compare two registers and jump if they are not equal

d) To perform conditional branching based on the carry flag

e) To move a value from one register to another

Answer: b) To check if a register is zero and jump accordingly. The jz instruction jumps to a specified
location if the register A is zero, while the jnz instruction jumps to a specified location if the register A is
not zero.

2. How do you add 3 to register A ten times in the 8051 microcontroller?

a) add A, #03

b) add A, R2

c) djnz R2, AGAIN

d) mov R5, A

e) mov A, #0

Answer:

mov A, #0 ; clear A

mov R2, #10 ; set R2 to 10


AGAIN: add A, #03 ; add 3 to A

djnz R2, AGAIN ; decrement R2 and jump to AGAIN if not zero

mov R5, A ; save the result in R5

Explanation: The code initializes register A to 0 and register R2 to 10. The add A, #03 instruction adds
3 to register A, and the djnz R2, AGAIN instruction decrements R2 and jumps back to the AGAIN label
if R2 is not zero. This process is repeated 10 times, and the final result is stored in register R5.

3. What is the purpose of the cjne instruction in the 8051 microcontroller?

a) To move a value from one register to another

b) To perform arithmetic operations

c) To compare two registers and jump if they are not equal

d) To check if a register is zero and jump accordingly

e) To perform conditional branching based on the carry flag

Answer: c) To compare two registers and jump if they are not equal. The cjne instruction compares the
value in register A or Rn with a given value or memory location, and jumps to a specified location if they
are not equal.

1. What is the period of machine cycle if the crystal frequency is 20MHz?

A) 0.6us

B) 0.75us

C) 1.2us

D) 1.5us

E) 2.4us

Answer: A) 0.6us

Explanation: Using the formula, period of machine cycle = 12/oscillator frequency, we get 12/20MHz =
0.6us.

2. How long does it take to execute the instruction "MOV R5,#FFH" for an 8051 system with a crystal
frequency of 12MHz?

A) 0.5us

B) 1.0us
C) 1.2us

D) 1.5us

E) 2.0us

Answer: C) 1.2us

Explanation: Using the formula, time to execute instruction = instruction set machine cycle x period of
machine cycle. Since "MOV R5,#FFH" has a machine cycle of 1, and the crystal frequency is 12MHz,
we get 1 x (12/12MHz) = 1us.

3. What is the time delay for the following program if the crystal frequency is 16MHz?

MOV A,#55H

AGAIN: MOV P1,A

ACALL DELAY

CPL A

SJMP AGAIN

;---time delay-------

DELAY: MOV R3,#100

HERE: DJNZ R3,HERE

RET

A) 108.5us

B) 136.5us

C) 217.0us

D) 435.0us

E) 870.0us

Answer: B) 136.5us

Explanation: The time delay is calculated by [(number of cycles in delay loop x 2) + 1 + 2] x period of
machine cycle. In this case, the delay loop has 100 cycles, so [(100x2) + 1 + 2] x (12/16MHz) =
136.5us.

4. What is the size of the delay in the following program if the crystal frequency is 11.0592MHz?

DELAY: MOV R2,#150

AGAIN: MOV R3,#200


HERE: NOP

NOP

DJNZ R3,HERE

DJNZ R2,AGAIN

RET

A) 1.085us

B) 2.17us

C) 4.34us

D) 8.68us

E) 17.36us

Answer: D) 8.68us

Explanation: The delay loop has 150 x 200 = 30,000 cycles. Therefore, [(30,000x2) + 1 + 2] x
(12/11.0592MHz) = 8.68us.

5. For the following program, what is the period of machine cycle if the crystal frequency is 8MHz?

DELAY: MOV R4,#50

AGAIN: MOV R5,#100

HERE: NOP

NOP

DJNZ R5,HERE

DJNZ R4,AGAIN

RET

A) 0.75us

B) 1.0us

C) 1.5us

D) 2.0us

E) 3.0us

Answer: C) 1.5us
Explanation: Using the formula, period of machine cycle = 12/oscillator frequency, we get 12/8MHz =
1.5us.

1. In the code snippet provided, what does the instruction "MOV R2,#200" do?

a) Moves the value 200 into register R2

b) Moves the value 200 into memory location #200

c) Moves the value of register R2 into memory location #200

d) Moves the value of memory location #200 into register R2

Answer: a) Moves the value 200 into register R2. This instruction initializes the value of register R2 to
200.

2. How long does the entire code snippet take to execute, given that Tmc = 1.085us?

a) 1085us

b) 217000us

c) 217651us

d) 140us

Answer: c) 217651us. This is calculated by adding the time it takes to execute the HERE loop (1085us)
and the time it takes to execute the AGAIN loop (200 x 1085us), and adding the additional time for the
instructions at the start and end of the AGAIN loop (651us).

3. In the code snippet provided in example 86, what is the value of Tmc?

a) 140

b) 55

c) 1.085us

d) Not specified

Answer: c) 1.085us. The value of Tmc is specified in the code snippet.

You might also like