
Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
![### Finding the Largest Item in an Array Using Assembly Language
To write an assembly program that finds the largest item in an array, follow these steps:
**Instructions:**
- **Objective:** Write an assembly program to find the largest item in an array and store it in a variable named `MAXIMUM`.
- **Hint:** Use both Jump and Loop instructions to craft the program.
**Logic:**
1. Assume the first item of the array is the maximum and store it in the variable `MAXIMUM`.
2. Implement a loop. Inside this loop, compare each array item with the current `MAXIMUM`.
3. If an array item is greater than the `MAXIMUM`, update `MAXIMUM` with that array item.
```assembly
.data
Array WORD 10, 2, 23, 45, 21, 11
MAXIMUM WORD ?
.code
; Write your code
```
**Explanation:**
- **Array Definition:** The array is defined with the values [10, 2, 23, 45, 21, 11].
- **Variable `MAXIMUM`:** This is uninitialized and will store the largest value found in the array.
- **Logic flow:** Start the comparison with the first element of the array and iterate using a loop to compare each subsequent element. If a larger element is found, update the `MAXIMUM` variable accordingly.](https://content.bartleby.com/qna-images/question/ce4a3dea-cc0f-44d5-90d3-67a4402c9c0c/1ef4a297-36d1-42db-92c1-6f305140c771/vlaz4tt_thumbnail.png)
Transcribed Image Text:### Finding the Largest Item in an Array Using Assembly Language
To write an assembly program that finds the largest item in an array, follow these steps:
**Instructions:**
- **Objective:** Write an assembly program to find the largest item in an array and store it in a variable named `MAXIMUM`.
- **Hint:** Use both Jump and Loop instructions to craft the program.
**Logic:**
1. Assume the first item of the array is the maximum and store it in the variable `MAXIMUM`.
2. Implement a loop. Inside this loop, compare each array item with the current `MAXIMUM`.
3. If an array item is greater than the `MAXIMUM`, update `MAXIMUM` with that array item.
```assembly
.data
Array WORD 10, 2, 23, 45, 21, 11
MAXIMUM WORD ?
.code
; Write your code
```
**Explanation:**
- **Array Definition:** The array is defined with the values [10, 2, 23, 45, 21, 11].
- **Variable `MAXIMUM`:** This is uninitialized and will store the largest value found in the array.
- **Logic flow:** Start the comparison with the first element of the array and iterate using a loop to compare each subsequent element. If a larger element is found, update the `MAXIMUM` variable accordingly.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution
Trending nowThis is a popular solution!
Step by stepSolved in 5 steps with 3 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Exercise 1: Determine the number of times that the for loop is executed for each of the following problems. A. for (int k = 3; k = 10; k) { // statements; } E. for (int time = 10; time >= 5; time++) { //statements; } F. What is the value of count after the nested for loops are executed? int count(0); for (int k = -1; k 0; k++) { count++;arrow_forwardDesign a simple program that asks the user to enter a store's sales for each day of the week. The amounts must be stored in an array using a loop - see below. Use another loop to calculate the total sales for the week and display the result. Also calculate the average of the daily sales and report that. Notes A loop structure with a single input instruction must be used to populate the array with the user's entries for the daily sales amounts After the user has entered the daily sales amounts, a separate loop must be used to accumulate the daily amounts into the total sales for the week Report out an average daily sales amount in addition to the total sales for the week. Submit a pseudocode file.arrow_forwardpythonarrow_forward
- The instructions in a pretest loop will always be processed at least once.a. Trueb. Falsearrow_forwardWrite an assembly function that uses a for loop to multiply all the numbers from 1 through and including N. Return the result. Print the returned value. Hello I was hoping someone could run through this code step by step as I am new to Assembly language, thank you!arrow_forwardOutput buffering makes your program slower True Falsearrow_forward
- Using a for Loop Summary In this lab the completed program should print the numbers 0 through 10, along with their values multiplied by 2 and by 10. You should accomplish this using a for loop instead of a counter-controlled while loop. Instructions 1. Write a for loop that uses the loop control variable to take on the values O through 10. 2. In the body of the loop, multiply the value of the loop control variable by 2 and by 10. 3. Execute the program by clicking the Run button at the bottom of the screen. Is the output the same? Grading When you have completed your program, click the Submit button to record your score. NewMultiply.cpp 1 // NewMultiply.cpp - This program prints the numbers through 2 // with these values multiplied by 2 and by 10. 3 // Input: None through 10 along with their val 4 // Output: Prints the numbers multiplied by 2 and by 10. 5 6 7 #include 8 #include 9 using namespace std; 10 11 int main() 12 { 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 string…arrow_forwardStart And Stop!Write an HLA Assembly language program that prompts for two specific int8 values named start and stop and then displays a repeated digit pattern starting with that number. The repeated digit pattern should show all the numbers beginning with the start value and then adding 1, 2, 3, 4, ... to this value until you hit a number greater than the stop value. Shown below is a sample program dialogue.Gimme a decimal value to use as a start: 6Gimme a decimal value to use as a stop: 78Here's your answer: 6_7_9_12_16_21_27_34_42_51_61_72_84Gimme a decimal value to use as a start: 8Gimme a decimal value to use as a stop: 31Here's your number: 8_9_11_14_18_23_29_36(Hint: The digit pattern is too large to store into any datatype we have learned to date so I am expecting that you will use a loop to print individual digits, rather than store the complete number in a variable.)arrow_forwardTrue/False 9. A loop is used to skip over a section of a programarrow_forward
- Design a program that asks the user to enter the amount that he or she has budgeted for a month. A loop should then prompt the user to enter each of their expenses for the month, and keep a running total. When the loop finishes, the program should display the amount that the user is over budget. Please provide answer in Pseudocode as well as python language. Please write line numbers before each line of the algorithm, include blank numbered lines between modules and write comments. Here are some parameters to solve the problem. a. Your Main module should declare two local variables and call three other modules.b. Create a module to get the amount budgeted for the month from the software user. c. Create a module that uses a loop to ask the software user for the price of each item purchased that month. The loop should stop when the software user does not reply with a lower case y to continue entering prices. make sure this loop has two lines.The loop should also contain an accumulator…arrow_forwardASSESSMENT TASK NO.6 1. Write a code using while loop that displays all numbers divisible by 5 from 5 to 95. 2 prom+sip pat pada 1994 w gana + poarrow_forwardJAVA Even if the condition is false at the first execution a while loop at least executes once. True False A while loop can be used both as an event-controlled loop and as a count controlled loop. True Falsearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education

Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON

Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education