
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
Question
Answer the given question with a proper explanation and step-by-step solution.
its all one question. please answer in mips code , the C code is given.
![Given an array of at least one integer, write a program to create a new array with elements equal to the exponent of each element in the
original array raised to the index, Le, B[i] = sum of 1st/ elements of A
For this, write the following two functions using Procedure Execution. (If procedure execution or functions are not used, you will receive a
score of 0, even if the tests pass).
. main
Following is a sample C code to perform the required task. You may modify the code for the functions, but the task performed should not be
changed
1
. nSum
1
task Create array B by obtaining the sum from the nSum function.
inputs: base address of array A ("A), index of B (k)
task compute the sum of 1st k elements of array A. (If array A elements are overwritten, the updated values should be used.)
return: sum of 1st k elements of array A
int main() (
// Variable
int' A, B:
int n
}
// Task of main function
for (int j = 0; j<nz j++) (
B(11= nSum (A, j);
int main() (
Declaration
int nSum (int. A, int k) (
int aum- A[0];
}
int' A, B:
int n;
// Base addresses of A and B
// Length of arrays A and B
// Variable Declaration
// Task of main
function
for (int j = 0; j<n; j++) {
B[j]nSum (A, j);
// Base addresses of A and B
// Length of arrays A and B
1
return (sum);
int nSum (int. A, int k) (
int sum- A[0];
for (int j = 1; j <-k; j++) {
sum - sum + A[j];
Registers Variables
$50
Ss1
$s2
A
SH0+4
B
n
Addresses Contents
$50
Alo]
All](https://content.bartleby.com/qna-images/question/f7cb6215-048b-47a5-b28f-7c86abf1a0e4/9390f30d-53a3-4089-b602-8e0e5f4538fc/srarft_thumbnail.jpeg)
Transcribed Image Text:Given an array of at least one integer, write a program to create a new array with elements equal to the exponent of each element in the
original array raised to the index, Le, B[i] = sum of 1st/ elements of A
For this, write the following two functions using Procedure Execution. (If procedure execution or functions are not used, you will receive a
score of 0, even if the tests pass).
. main
Following is a sample C code to perform the required task. You may modify the code for the functions, but the task performed should not be
changed
1
. nSum
1
task Create array B by obtaining the sum from the nSum function.
inputs: base address of array A ("A), index of B (k)
task compute the sum of 1st k elements of array A. (If array A elements are overwritten, the updated values should be used.)
return: sum of 1st k elements of array A
int main() (
// Variable
int' A, B:
int n
}
// Task of main function
for (int j = 0; j<nz j++) (
B(11= nSum (A, j);
int main() (
Declaration
int nSum (int. A, int k) (
int aum- A[0];
}
int' A, B:
int n;
// Base addresses of A and B
// Length of arrays A and B
// Variable Declaration
// Task of main
function
for (int j = 0; j<n; j++) {
B[j]nSum (A, j);
// Base addresses of A and B
// Length of arrays A and B
1
return (sum);
int nSum (int. A, int k) (
int sum- A[0];
for (int j = 1; j <-k; j++) {
sum - sum + A[j];
Registers Variables
$50
Ss1
$s2
A
SH0+4
B
n
Addresses Contents
$50
Alo]
All
![Registers Variables
$50
A
$$1
The resultant array B is:
$$2
SS0+4
Addresses Contents
S$0
A[0]
A[1]
Ss0+4 (n-1)
B
n
Example Test: If the values of Ss1 through $57 are initialized in the simulator as: (Use the button under the Registers display to initialize
register values for Ss0, Ss1, $s2 and the + button under the Memory display to initialize the A array elements.)
S$2
Aln-11
Registers Data
$$0
$$1
4000
8000
5
Addresses Contents
4000
10
Registers Data
Ss0
Ss1
$s2
4000
4004
Addresses Contents
10
4008
4012
4016
8004
8008
4000
8012
8000
8016
5
5
Addresses Contents
8000
10
-5
2
0
15
10
8
8](https://content.bartleby.com/qna-images/question/f7cb6215-048b-47a5-b28f-7c86abf1a0e4/9390f30d-53a3-4089-b602-8e0e5f4538fc/863mix_thumbnail.jpeg)
Transcribed Image Text:Registers Variables
$50
A
$$1
The resultant array B is:
$$2
SS0+4
Addresses Contents
S$0
A[0]
A[1]
Ss0+4 (n-1)
B
n
Example Test: If the values of Ss1 through $57 are initialized in the simulator as: (Use the button under the Registers display to initialize
register values for Ss0, Ss1, $s2 and the + button under the Memory display to initialize the A array elements.)
S$2
Aln-11
Registers Data
$$0
$$1
4000
8000
5
Addresses Contents
4000
10
Registers Data
Ss0
Ss1
$s2
4000
4004
Addresses Contents
10
4008
4012
4016
8004
8008
4000
8012
8000
8016
5
5
Addresses Contents
8000
10
-5
2
0
15
10
8
8
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 3 steps

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
- The assignment is to create a MIPS program that demonstrates that the associative law fails in addition for floating point numbers (single or double precision). You only need to demonstrate it for single precision. Remember the associative law is a + (b + c) = (a + b) + c. The key is to have two of the number large (one positively and one negatively but equal in magnitude) floating point numbers and the third floating point number very small in comparison. ***Please make sure you include comments in every field*** Note: make sure the program operats and doesnt run with errors like: operand is of incorrect type or not formattedarrow_forwardIn this problem we will work through a round of DES. For notational simplicity, assume it is the first round. Please enter all answers as strings of 0's and 1's. The input is the 64 bit block 0000000000000010000000000000001000000100000001000100000000000000 Suppose that the subkey for the current round is this 48 bit number: 000000000000000001000000000000000000000000000000 What does the 64 bit state look like after the IP transformation is applied to the input? 00000000000110000100000000000000 Now find Lo and Ro, the left and right halves of the state. Lo 01000000010000000000000000010000 = Ro=00000000000000100000000000000000 What is the result of applying the expansion box to R₁? E(Ro) = 00000000000000100000000000000000 What is the result of XORing the subkey with E(Ro)? k₁ E(Ro) = 00000000000000100000000000000000 We now apply the S-box transformation. S(k₁ E(Ro)) = 11011000110110001101111110111100 Finally we apply the permutation box to complete the function f. f(Ro) = P(S(k₁ + E(Ro)))…arrow_forwardSolve using assembly language x86 processors and compatibles Prompt the user for coefficients a, b, and c of a polynomial in the form ax2 + bx + c = 0. Calculate and display the real roots of the polynomial using the quadratic formula. If any root is imaginary, display the appropriate message.arrow_forward
- Question 4: a) What is Cyclic Redundancy Check (CRC) and how it works? b) Generate hamming code for the message 1110110.arrow_forwardGiven the following code, answer the following questions: seq=range(n)s=0for x in seq: for y in seq: s+=x*y What is the big-O notation? What is the code doing?arrow_forwardEach item in a store's inventory is assigned a unique binary sequence using binary numerals. If the shop has between 75 and 100 goods in its inventory, what is the minimum amount of bits necessary for each binary sequence?arrow_forward
- The erroneous data and control bits were received as 1110101 with a 1 bit error. This format uses D4 D3 D2 C3 D1 C2 C1 where Ds are data bits and Cs are control bits. Find the original error free 4 bit data by VENN diagram. (help: place the bits as shown in the figure. Numbers are bit positions starting from the right). You have to show your solution steps.arrow_forwardWhen the result of an unsigned arithmetic operation is too big to fit into the destination, what flag is set?arrow_forwardHi, good evening! I need an answer to this question. Thank you. Question: What are some notable differences when examining a Mac rather than a Windows PC?arrow_forward
- For AES with a 128 bit block length and a 128-bit key length, what is the output of the first round of AES if the plaintext consists of 128 1's and the first subkey also consists of 128 zeroesarrow_forwardProvide the correct answers to each questionarrow_forwardIn this scheme, how many different numbers are representable and What is the largest number represented in this system? (Give your answer as a fraction in its lowest form.).,Finally What number represents 7/10 in this system?arrow_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