Question
Hi

2. (5pts) Given an array declaration: array[4][3] stored at memory location Ox1000, give an equation to find the element at t
New Text Document (2) - Notepad File Edit Format View Help 5. (4pts) Give one advantage and one disadvantage of Pythons use
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

a) In row major order, the address of [i,j]th element is given as:

Address of array[i][j] = BA + W[n(i - Lr) + (j - Lc)]

where,

BA = base address

W = element size in bytes

n = number of columns

Lr = first row number

Lc = first column number

Given that, array[4][3] is stored at location 0x1000.

We can use this information and put it in above formula to compute the base address.

Once base address is known we can find the location of array[2][1].

b) Advantage:

The code indentation of python to specify compound statements in control constructs makes the code cleaner. The readability of the code is increased and the code reader can better understand python codes.

Disadvantage:

As a beginner, code indentation could be intimidating. For multiple nested loops the indentation quickly becomes a mess to manage and harder to understand.

Add a comment
Know the answer?
Add Answer to:
Hi 2. (5pts) Given an array declaration: array[4][3] stored at memory location Ox1000, give an equation...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Description An array in C++ is a collection of items stored at contiguous memory locations and...

    Description An array in C++ is a collection of items stored at contiguous memory locations and elements can be accessed randomly using indices of an array. They are used to store similar type of elements as in the data type must be the same for all elements. One advantage of arrays is easy data manipulation and accessibility of elements stored in consecutive locations. The Problem: One teaching assistant of a computer science department in Engineering University got a simple question...

  • C LANGUAGE!!! The program uses both files and two dimensional arrays. The Problem Statement Business is...

    C LANGUAGE!!! The program uses both files and two dimensional arrays. The Problem Statement Business is going well for your friend, who is selling discounts to area clubs and restaurants, which means that business is going well for you! Both of you have decided that you'll advertise on memory mall, which is roughly arranged as a rectangle. There's not enough time before a football game to hand flyers to everyone arranged on the mall. Therefore, you will only be able...

  • Tasks Write a program that prints in text mode Project 2 written by YOURNAME And shows...

    Tasks Write a program that prints in text mode Project 2 written by YOURNAME And shows in a graphical way, as shown below, the names stored in a file. The coordinates to print the names will be also read from another file. Here is an example of what your graphic output should look like with the two files that are provided for test purposes. Drawing Panel Adam Bernie Cameron Daniel Fanny Gerard Harold Issac Jackie Raitlyn Note that the colors...

  • Hi im having trouble with this homework question. Can someone show me how to do this in C++ with all the steps? Weather Analysis WeatherAnalyzer - New Day Data 2- Good Days 3- Summary 0- Exit Step 0:...

    Hi im having trouble with this homework question. Can someone show me how to do this in C++ with all the steps? Weather Analysis WeatherAnalyzer - New Day Data 2- Good Days 3- Summary 0- Exit Step 0: You can get the sample file from this link: Each row in the text file represent weather measurement of a day. For each day, the file contains the temperature (first column), humidity (second column) and the wind (third column) values emp 70...

  • In a new file located in the same package as the class Main, create a public...

    In a new file located in the same package as the class Main, create a public Java class to represent a photograph that consists of a linear (not 2D) array of pixels. Each pixel is stored as an integer. The photograph class must have: (a) Two private fields to represent the information stored about the photograph. These are the array of integers and the date the photograph was taken (stored as a String). The values in the array must be...

  • 1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true &&...

    1). The result of Java expression 5*7>3*(5+2) && 3*5-4<6 is ____ a. 35>35&&9<6 b. true && false c. false d. False (2). You save text files containing Java language source code using the file extension___ a. .java b. .class c. .txt d. .src    (3). Which of the following is not a primitive data type in the Java programming language? a. boolean b. byte c. int d. Point (4). Given the Java statement int[][] vari = new int[5][7]; the value...

  • could you please help me with this problem, also I need a little text so I...

    could you please help me with this problem, also I need a little text so I can understand how you solved the problem? import java.io.File; import java.util.Scanner; /** * This program lists the files in a directory specified by * the user. The user is asked to type in a directory name. * If the name entered by the user is not a directory, a * message is printed and the program ends. */ public class DirectoryList { public static...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT