0% found this document useful (0 votes)
6 views11 pages

MPMC

This flowchart describes a process to test a set of 100 resistors for a 10% tolerance. It initializes a counter, measures each resistor's value, calculates the tolerance range, checks if the value falls within the range, and increments the counter if it does. It repeats this for all resistors and displays the final count of resistors within tolerance.

Uploaded by

egokul03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views11 pages

MPMC

This flowchart describes a process to test a set of 100 resistors for a 10% tolerance. It initializes a counter, measures each resistor's value, calculates the tolerance range, checks if the value falls within the range, and increments the counter if it does. It repeats this for all resistors and displays the final count of resistors within tolerance.

Uploaded by

egokul03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

1.

You are given a set of 100 resistors with 10 k value and asked to test them for 10 percent
tolerance. Reject all the resistors that are outside the tolerance and give the final number of
resistors you found within the tolerance. Draw a flow- chart.

ANS:
Start

Initialize Counter (Count = 0)

For Each Resistor in the Set



Measure the Resistor Value

Calculate the Tolerance Range (±10%)

Check if Resistor Value is within Tolerance Range

Yes

Increment Counter (Count = Count + 1)

Continue to Next Resistor

No

Reject the Resistor

Continue to Next Resistor

Repeat for All Resistors in the Set

Final Number of Resistors Within Tolerance = Count



Display Count

End

In this flowchart:
1. We start by initializing a counter variable to keep track of the number of resistors within
tolerance.
2. For each resistor in the set of 100 resistors:
 Measure the resistor's value.
 Calculate the tolerance range, which is ±10% of the nominal value (10k).
 Check if the resistor's value falls within the tolerance range:
 If yes, increment the counter by 1 to keep track of the number of resistors within
tolerance and continue to the next resistor.
 If no, reject the resistor and continue to the next resistor.
3. Repeat this process for all 100 resistors in the set.
4. Finally, display the count, which represents the number of resistors within tolerance, as the
result.

2.You are given a big grocery list for a party and asked to buy the items starting from number 66 The
maximum amount you can spend is $125. Draw a flow- char.

ANS:

Start

Initialize Total Cost (Cost = 0)

Initialize Item Number (Item = 1)

While Item Number <= Total Number of Items

If Item Number < 66

Skip to Next Item (Item = Item + 1)

Else

Get the Cost of the Current Item

If (Cost + Cost of Current Item) <= $125

Add Cost of Current Item to Total Cost (Cost = Cost + Cost of Current Item)

Purchase the Current Item

Else

Skip the Current Item

End If

Move to the Next Item (Item = Item + 1)

End If

End While

Display Total Cost

End

In this flowchart:

1. We start by initializing the total cost (Cost) to $0 and the item number (Item) to 1.

2. We enter a loop that continues as long as the item number is less than or equal to the total
number of items on the grocery list.

3. Inside the loop, we check if the item number is less than 66. If it is, we skip to the next item, as
we are only interested in items starting from number 66.

4. If the item number is 66 or greater, we:

 Get the cost of the current item.

 Check if adding the cost of the current item to the total cost (Cost) exceeds the budget
of $125.

 If not, we add the cost of the current item to the total cost and mark the item as
purchased.

 If adding the cost exceeds the budget, we skip the current item.

 Move to the next item in the list.

5. Repeat this process for all items on the list starting from number 66.

6. Finally, display the total cost, which represents the amount spent on the purchased items within
the budget.
3.In the receiving department of a manufacturing company, auto parts are placed in a sequential
order from 0000 to 4050. These parts need to be transferred to the bins on the factory floor,
marked with the starting number 8000. You have an intelligent robot that can read the bin
numbers and transfer the parts. Draw a flowchart to in- struct the robot to transfer 277 parts
starting from bin number 1025 in the receiving department to the starting bin number 8060 on the
floor.

ANS:

Start

Initialize Part Count (Count = 0)
Initialize Current Bin (Bin = 1025)
Initialize Target Bin (Target = 8060)

While Part Count < 277



If Current Bin > 4050

Display "No more parts available"

End
Else

Transfer Part from Current Bin to Target Bin

Increment Part Count (Count = Count + 1)

Increment Current Bin (Bin = Bin + 1)

Increment Target Bin (Target = Target + 1)

End If
End While

Display "Transfer Complete"



End

In this flowchart:
1. We start by initializing the part count (Count) to 0, the current bin number (Bin) to 1025, and the
target bin number (Target) to 8060.
2. We enter a loop that continues until the part count reaches 277.
3. Inside the loop, we check if the current bin number (Bin) is greater than 4050, which is the
maximum bin number in the receiving department. If it is, we display a message indicating that
there are no more parts available and terminate the process.
4. If the current bin number (Bin) is within the valid range, we:
 Transfer a part from the current bin to the target bin.
 Increment the part count by 1 to keep track of the number of parts transferred.
 Increment both the current bin and the target bin numbers by 1 to move to the next
bins.
5. We repeat this process until the part count reaches 277.
6. Finally, we display a message indicating that the transfer is complete, and the flowchart ends.
This flowchart instructs the robot to transfer 277 parts starting from bin number 1025 in the
receiving department to the starting bin number 8060 on the factory floor while ensuring that it
stays within the valid bin range.

4.A newly hired librarian was given a set of new books on computers and English literature.
The stack of computer books was placed above the English books. The librarian was asked to
find the total amount spent on computer books, the prices were marked on the back cover of
each book. Draw a flowchart representing the process
ANS:
Start

Initialize Total Cost (Cost = 0)

While There Are More Books on the Shelf



Read the Back Cover of the Next Book

If the Book Is a Computer Book

Read the Price Marked on the Back Cover

Add the Price to the Total Cost (Cost = Cost + Price)

End If

End While

Display Total Cost



End

In this flowchart:
1. We start by initializing the total cost (Cost) to 0.
2. We enter a loop that continues until there are more books on the shelf to check.
3. Inside the loop, we:
 Read the back cover of the next book to determine its category (computer book or
English literature book).
4. If the book is identified as a computer book, we:
 Read the price marked on the back cover of the computer book.
 Add the price to the total cost (Cost) to keep track of the total amount spent on
computer books.
5. The loop continues to the next book until there are no more books on the shelf.
6. After processing all the books, we display the total cost, which represents the total amount
spent on computer books.
This flowchart guides the newly hired librarian through the process of finding and adding up the
prices of computer books to determine the total cost.

5.Specify the memory location and its contents after the following instructions are executed.

MVI B.F7H MOV A,B STA XX75H HLT.

ANS:
Memory Contents:
 Memory location XX75H: F7H (247 in decimal)
Registers:
 Register A: F7H (247 in decimal)
 Register B: F7H (247 in decimal)
After these instructions have been executed, the memory location XX75H contains the value F7H
(247 in decimal), and the registers A and B both contain the value F7H (247 in decimal).

6.Show the register contents as each of the following instructions is being executed

A B C D E H L

MVI C,FFH
LXI H.XX70H
LXI D.XX70H
MOV M.C
LDAX D
HLT
ANS:

1. MVI C,FFH: This instruction loads the value FFH (255 in decimal) into register C.
Registers:
 A: 00H
 B: 00H
 C: FFH
 D: 00H
 E: 00H
 H: 00H
 L: 00H
2. LXI H, XX70H: This instruction loads the value XX70H (let's assume it's 2070H) into the HL register
pair. It sets H=20H and L=70H.
Registers:
 A: 00H
 B: 00H
 C: FFH
 D: 00H
 E: 00H
 H: 20H
 L: 70H
3. LXI D, XX70H: This instruction loads the same value XX70H into the DE register pair. It sets D=20H
and E=70H.
Registers:
 A: 00H
 B: 00H
 C: FFH
 D: 20H
 E: 70H
 H: 20H
 L: 70H
4. MOV M, C: This instruction copies the contents of register C (which is FFH) to the memory
location pointed to by the HL register pair (2070H).
Memory:
 Memory location 2070H: FFH
5. HLT: This instruction is a halt instruction. There is no change to the memory or registers after this
instruction.
6. LDAX D: This instruction loads the contents of the memory location pointed to by the DE register
pair (2070H) into register A.
Registers:
 A: FFH
 B: 00H
 C: FFH
 D: 20H
 E: 70H
 H: 20H
 L: 70H
After executing these instructions, the register contents and memory location 2070H have been
updated as shown above.

7. In Question 6, specify the contents of the accumulator and the memory location XX70H after
the execution of the instruction LDAX D.
ANS:

After the execution of the LDAX D instruction, the contents of the accumulator (A) and memory
location XX70H will be as follows:
 Contents of the Accumulator (A): FFH (255 in decimal)
 Memory Location XX70H: FFH (255 in decimal)
The LDAX D instruction loads the contents of the memory location pointed to by the DE register
pair (which is 2070H) into the accumulator (A). In this case, the value stored at memory location
2070H is FFH, and that value is also loaded into the accumulator.

8. Identify the memory locations that are cleared by the following instructions.
MVI B,00H
LXI H.XX75H
MOV M,B
INX H
MOV M,B
HLT
ANS:
the memory locations that are cleared by these instructions are XX75H (cleared to 00H) and the
memory location immediately after XX75H (also cleared to 00H).

9.Specify the contents of registers A, D, and HL after execution of the following in-
structions.

LXI H.XX90H ;Set up register HL as a memory pointer


SUB A ;Clear accumulator
MVI DOFH ; Set up register D as a counter
LOOP: MOV MA ; Clear memory
INX H ; Point to the next memory location
DCR D ; Update counter
JNZ LOOP ; Repeat until (D)=0
HLT
ANS:
After the execution of these instructions, the contents of registers A, D, and HL are as follows:
 Contents of A: 00H
 Contents of D: 0EH (14 in decimal)
 Contents of HL: XX91H (points to the next memory location after the loop)

10.Explain the result after the execution of the program in Question 9.


ANS:

After the program execution:

 Memory locations from XX90H to XXA4H (15 locations in total) will contain the value 00H
(cleared).

So, the result after the execution of the program is that 15 consecutive memory locations have been
cleared, and their contents are all set to 00H. The rest of the memory locations outside this range
remain unaffected.

11.Rewrite the instructions in Question 9 using the register BC as a memory pointer.

ANS:
LXI B, XX90H ; Set up register BC as a memory pointer
MVI C, 0FH ; Set up register C as a counter

LOOP: MOV M, A ; Clear memory


INX B ; Point to the next memory location
DCR C ; Update counter
JNZ LOOP ; Repeat until (C) = 0
HLT

In this modified program:

1. LXI B, XX90H: This instruction initializes the BC register pair to point to a specific memory
location, represented as XX90H.

2. MVI C, 0FH: This instruction loads the value 0FH (15 in decimal) into register C, setting it up as a
counter. This means the program will clear 15 consecutive memory locations.

3. LOOP: MOV M, A: This is a loop that runs as long as the counter in register C is not zero. In each
iteration, it clears the memory location pointed to by the BC register pair.

 The memory location pointed to by BC is initially XX90H.

 In each iteration, the content of that memory location is set to 00H.

4. INX B: After clearing the memory location pointed to by BC, this instruction increments the BC
register pair, pointing to the next memory location.

5. DCR C: This instruction decrements the counter in register C.

6. JNZ LOOP: This instruction checks if the zero flag is not set (meaning C is not zero). If C is not
zero, it jumps back to the LOOP label, continuing the loop.

 This loop continues for 15 iterations, clearing 15 consecutive memory locations.

7. HLT: This instruction is a halt instruction and doesn't affect any registers or memory locations.
With this modified program, the BC register pair is used as a memory pointer to clear the same 15
consecutive memory locations as in the previous program.

12. Explain how many times the following loop will be executed.

LXI B,0007H

LOOP: DCX B

JNZ LOOP

ANS:

Infinit loop.DCS instruction does not affect Z flag.

13. Explain how many times the following loop will be executed.

LXI B.0007H

LOOP DCX B

MOV AB

OKA C

INZ LOOP

ANS:

7 times.

14. The following instructions are intended to clear ten memory locations starting from the
memory address 0009H. Explain why a large memory block will be erased or cleared and the
program will stay in an infinite loop.

LXI H,0009H

LOOP: MVI M,00H

DCX H JNZ LOOP

HLT

ANS:

DCX instruction does not affect Z flag.


15. The following block of data is stored in the memory locations from XX55H to XXSAH. Transfer
the data to the locations XX80H to XX85H in the reverse order (e.g., the data byte 22H should be
stored at XX85H and 37H at XX80H). Data(H) 22, A5, B2, 99, 78 37.

ANS:

START:LXI H, 2055H

LXI D, 2085H MVI B, 06H MOV A. M

STAX D INX H

DCX D

DCR B JNZ NEXT

HLT

Index for data source

;Index for data destination, starting at last location

Byte counter Get data byte

Store data byte

Next location

NEXT:

Next count

If counter is not 0, go back to transfer next byte

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy