Question: Consider the array declaration: int sales[5] = {10000, 12000, 900, 500, 20000}; A. the statement sales[3] = sales[3] + 10; will replace the number____ 1.500

Consider the array declaration:

int sales[5] = {10000, 12000, 900, 500, 20000};

A. the statement sales[3] = sales[3] + 10; will replace the number____

1.500 with 10

2.500 with 510

3.900 with 10

4.900 with 910

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

B. The statement sales[4] = sales[4-2]; will replace the number_____

1.500 with 498

2.20000 with 900

3.20000 with 19998

4.500 with 12000

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

C. Which of the if-statements verifies that the array subscript stored in the x variable is valid for the sales array?

1. if (x >= 0 && x<4)

2. if (x >= 0 && x <= 4)

3. if (sales[x] >= 0 && sales[x] <4)

4. if (sales[x] >= 0 && sales[x] <=4)

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

D. which of the following will correctly add the number 100 to each variable in sales array? x variable is declared as int x=0;

1. while (x<=4)

x += 100;

2. while (x <= 4)

{ sales = sales + 100;

x +=1;

}

3. while (sales < 5)

{ sales[x] +=100;

}

4.while (x <=4)

{ sales[x] += 100;

x += 1;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!