1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
nalin [4]
2 years ago
15

Suppose that a is declared as an int a[99]. Give the contents of the array after the following two statements are executed: for

(i = 0; i <99 ; i++) a[i] = a[a[i]];
Computers and Technology
1 answer:
mr_godi [17]2 years ago
5 0

Answer:

Each array position holds the position from which the information is going to be retrieved. After the code is run, each position will have the information retrieved from that position.

Explanation:

The best way to solve this problem is working as if we had a very small array. Then we can generalize for the large array.

For example

int a[3];

a[0] = 1; a[1] = 2; a[2] = 0;

for(i = 0; i < 3; i++)

a[i] = a[a[i]];

When i = 0, we have:

a[i] = a[a[i]] = a[a[0]] = a[1] = 2;

When i = 1, we have

a[i] = a[a[i]] = a[a[1]] = a[2] = 0;

When i = 2, we have

a[i] = a[a[i]] = a[a[2]] = a[0] = 1;

Basically, in our small example, each array position holds the index from which we are going to retrieve the information. The same is going to happen in the array of length 99. After the code is run, each position will have the information retrieved from that position

You might be interested in
Which phrase is the best definition of sparklines in Excel 2016?
ddd [48]

Answer:

Option 2: a type of mini chart that users can insert into a worksheet

Explanation:

A graph or chart is used to show trends and changes in a dataset.

When we have to show trends or changes in MS Excel, there are a lot of options available. One of them is Sparklines. Sparklines are like mini charts that can be used to show data graphically.

Hence,

The correct answer is:

Option 2: a type of mini chart that users can insert into a worksheet

5 0
2 years ago
Read 2 more answers
ERP implementation probably will not require:
Mamont248 [21]

Answer:

c. just a few weeks to install.

Explanation:

ERP is known as Enterprise Resource Planning.ERP implementation involves software installation, transfer of the financial data to the new system, configuration of the users and processes and training the users on the software.

It also involves upgrades after installation,cross-functional teams, intensive training, high funding for both initial cost and maintenance. This whole process usually takes place between 6 months to 2 years. This makes option C which says it takes few weeks to install incorrect.

3 0
3 years ago
Read 2 more answers
What commonly predefined alias is configured to run the ls âl command?
coldgirl [10]
<span>The l</span><span>l command is the commonly predefined alias that is configured to run the ls âl command. The command ls stands for list. So instead of writing list, in Linux you only write the command ls.
The alias are </span>shortcuts and time-savers. By typing ll we'll get the current directory's listing, in long format, including hidden directories.


6 0
3 years ago
Find the root using bisection method with initials 1 and 2 for function 0.005(e^(2x))cos(x) in matlab and error 1e-10?
frutty [35]

Answer:

The root is:

c=1.5708

Explanation:

Use this script in Matlab:

-------------------------------------------------------------------------------------

function  [c, err, yc] = bisect (f, a, b, delta)

% f the function introduce as n anonymous function

%       - a y b are the initial and the final value respectively

%       - delta is the tolerance or error.

%           - c is the root

%       - yc = f(c)

%        - err is the stimated error for  c

ya = feval(f, a);

yb = feval(f, b);

if  ya*yb > 0, return, end

max1 = 1 + round((log(b-a) - log(delta)) / log(2));

for  k = 1:max1

c = (a + b) / 2;

yc = feval(f, c);

if  yc == 0

 a = c;

 b = c;

elseif  yb*yc > 0

 b = c;

 yb = yc;

else

 a = c;

 ya = yc;

end

if  b-a < delta, break, end

end

c = (a + b) / 2;

err = abs(b - a);

yc = feval(f, c);

-------------------------------------------------------------------------------------

Enter the function in matlab like this:

f= @(x) 0.005*(exp(2*x)*cos(x))

You should get this result:

f =

 function_handle with value:

   @(x)0.005*(exp(2*x)*cos(x))

Now run the code like this:

[c, err, yc] = bisect (f, 1, 2, 1e-10)

You should get this result:

c =

   1.5708

err =

  5.8208e-11

yc =

 -3.0708e-12

In addition, you can use the plot function to verify your results:

fplot(f,[1,2])

grid on

5 0
3 years ago
Write a program that prompts the user for the lengths of the two legs of a right triangle, and which reports the length of the h
timurjin [86]

Answer: The following code is in c++

#include <iostream>

#include<math.h>

using namespace std;

int main()

{

   float a,b,c;

   cout<<"Enter height and base of triangle\n";

   cin>>a>>b;  //reading two sides from user

   c=sqrt(pow(a,2)+pow(b,2));  //calculating hypotenuse

   cout<<"Length of hypotenuse is "<<c;  //printing third side of triangle

   return 0;

}

OUTPUT :

Enter height and base of triangle                                                                                            

3                                                                                                                              

4                                                                                                                              

Length of hypotenuse is 5  

Explanation:

In the above code, three variables a, b and c of int type are declared. After that, it is asked from user to enter the value of a and b. The user puts the value and then c is calculated with the help of Pythagoras theorem formulae which squares the values of two sides and then adds them to calculate hypotenuse of a right angled triangle and finally c is printed to console.

3 0
3 years ago
Other questions:
  • To move to the most extreme right cell containing data in your worksheet, what basic key combination can you use?
    7·1 answer
  • In the spreadsheet example shown in chapter 5 ____ run from top bottom and are designated by a letter?
    12·2 answers
  • Tree diagrams are useful for
    12·1 answer
  • What are some benefits of 3-D printing?
    9·1 answer
  • Write a program that:
    13·1 answer
  • How to fix a light blub
    11·2 answers
  • The ______ engine compares your entry against its database and returns a list of hits or sites that contain the keywords. (hint:
    8·1 answer
  • What do we call the software which programmers use to program?​
    6·1 answer
  • [2]<br> (c) Describe how the microprocessor can determine when to sound the clock alarm.
    6·1 answer
  • Write algorithm and flowchart for the following<br>a.find the sum and average of any four numbers ​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!