Consider the following source code, where R, S, and T are constants declared with #define:
In compiling this program, GCC generates the following assembly code.
A. Extend Equation 3.1 from two dimensions to three to provide a formula for the location of array element A [i] [j] [k].
B. Use your reverse engineering skills to determine the values of R, S, and T based on the assembly code.
Want to see the full answer?
Check out a sample textbook solutionChapter 3 Solutions
Computer Systems: A Programmer's Perspective (3rd Edition)
Additional Engineering Textbook Solutions
Digital Fundamentals (11th Edition)
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
Modern Database Management
Starting Out with Java: From Control Structures through Data Structures (3rd Edition)
Introduction to Programming Using Visual Basic (10th Edition)
C++ How to Program (10th Edition)
- Reference the image below.(a) Write a code in python to implement Hoare's algorithm.(b) Using LArray = {36, 12, 39, 34, 89, 2, 47, 95, 17, 19, 78, 22} as input, display the finaloutput and the array LArray after it has been manipulated by the algorithm.(c) Modify the algorithm to display the LArray after each swap done, being sure to indicatewhat swap is being observed.arrow_forwardLanguage: C Print a Mayo pyramid with # characters depending on user input, i.e., the pyramid height h. To this end, update the size of the array for each level of the pyramid (for each for loop passing) using the realloc function. First of all, allocate an array for the first row. You need the allocate the memory for h + 2 characters for the first row. Fill it with spaces, using the memset(row, ’ ’, h+2) command. For each row i, expand the array size to h + 4 + i, replace the last two characters of the line with # sign, followed by the string’s null terminator. That’s why you need increase the size by 2, with the respect to the original allocation, and then by 1 at each step. You also need to replace the space at the position h − 1 − i with the # character (the left slope of the pyramid). Print and examine your results, free the memory and use the valgrind function to check memory usage.arrow_forwardWrite a c program Write a program which should consists of a user defined function Task (). Pass 1D array to the function, along with number of elements of array. Find out the maximum element in 1D array using this function.[Note: Array should be passed using by reference approach]arrow_forward
- In c++ , perform insertion into the dynamic array at the start, end, and middle as well and perform array resizing as well. ( Drop code in words , explain the code and drop the screenshot of output as well )arrow_forwardUse the PEP/8 assembely machine language simulator to write a program that simulates the PEP/8 computer and instruction set for only the following instructions (the following instructions are in the image attached) Here are some specifics. 1.Use an array to represent the memory. 2.Use variables or arrays for the PEP8 registers. I recommend putting it all into a structure. I also recommend using an array of 16 bit values for A, X, PC, SP so that you can use the r bit from the instructions to point directly to A or X. You do NOT have to include the Status bits.arrow_forwardWrite a program in C++ to read array 2D with size 3x4 and perform the following: 1- Replace each element in the first row by the constant 2. 2- Find the sum of secondary diameter elements.arrow_forward
- Write a code in C++ and create a two dimensional Array of size 5 X 5.(1) Inserting the following numbers.(2) Create a dynamic 2-dimensional array of size 5 X 5;(3) After inserting all numbers, display sum and average of all numbers of Array? 465 8 47 93 786 97 26 78 1327 34 77 47 5692 68 34 68 7773 69 37 78 87arrow_forwardWrite a C program which initially creates 2 two-dimensional integer arrays: arrayA and arrayB. The size of the arrays should be 4 x 4. The program should use scanf() to take an integer test input (x). The program should then create and print array A and array B as shown: array A [x, 2x, 3x, 4x, 2x, 4x, 6x, 8x, 3x, 6x, 9x, 12x 4x, 8x, 12x, 16x] Array B [2x, 3x, 4x, 5x, 4x, 6x, 8x, 10x, 6x, 9x, 12x, 15x, 8x, 12x, 16x, 20x ] The program should then create and print new arrays for each of the following situations: • An array containing the sum of corresponding cells in arrayA and arrayB • An array containing the sum of corresponding rows in arrayA and arrayB• An array containing the sum of corresponding columns in arrayA and arrayB Note: include exactly one space after each element in each array (including the last one), each row on a new line, and exactly one blank line after each array as shown in the example. For example: Input Result 2 2 4 6 8 4 8 12 16 6 12 18 24 8 16…arrow_forwardQuestion #4 To gain a bit of practice writing CUDA programs your warm-up task is to implement the SAXPY function in CUDA (The name "SAXPY" stands for "single-precision a times x plus y."). For input arrays x and y, output array dest, and value a (all single-precision floating-point values), the function computes dest[i] = a*x[i]+y[i] for all array elements i. You can assume any value for "a". You need to test your program on a real GPU. i want solve this question on CUDA SAXPYarrow_forward
- There is a close association between pointers and arrays. Recall that an array variable is actually a pointer variable that points to the first indexed variable of the array. Array elements can be accessed using pointer notation as well as array notion. One problem with static arrays is that we must specify the size of the array when we write the program. This may cause two different problems: (1) we may create an array much larger than needed; or (2) we may create one that is smaller than what is needed. In general, this problem is created because we do not know the size of the array until the program is run. This is where dynamic arrays can be used. The new expression can be used to allocate an array on the freestore. Since array variables are pointer variables, you can use the new operator to create dynamic variables that are arrays and treat these dynamic array variables as if they were ordinary arrays. Array elements can also be accessed using pointer notation as well as array…arrow_forwardWrite a code in C++ and create a two dimensional Array of size 5 X 5. (1) Inserting the following numbers. (2) After inserting all numbers, display sum and average of all numbers of Array?arrow_forwardThere is a close association between pointers and arrays. Recall that an array variable is actually a pointer variable that points to the first indexed variable of the array. Array elements can be accessed using pointer notation as well as array notion. One problem with static arrays is that we must specify the size of the array when we write the program. This may cause two different problems: (1) we may create an array much larger than needed; or (2) we may create one that is smaller than what is needed. In general, this problem is created because we do not know the size of the array until the program is run. This is where dynamic arrays can be used. The new expression can be used to allocate an array on the freestore. Since array variables are pointer variables, you can use the new operator to create dynamic variables that are arrays and treat these dynamic array variables as if they were ordinary arrays. Array elements can also be accessed using pointer notation as well as array…arrow_forward
- 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