Exercise 01v2 (1).docx - Tutorial 01 – One Dimensional Array 1 Given the declaration double sales[5 = 40.5 65.5 70.0 98.0 32.5 The following statement

Exercise 01v2 (1).docx - Tutorial 01 – One Dimensional...

This preview shows page 1 - 3 out of 4 pages.

Tutorial 01 – One Dimensional Array 1.Given the declaration:double sales[5] = { 40.5, 65.5, 70.0, 98.0, 32.5 };The following statementsales[4] = sales[1] + sales[2];updates the content of the array element from A.98.0 to 106.0 B.32.5 to 98.0 C.98.0 to 70.0 D.32.5 to 135.5 2.According to the following declaration, which statement(s) is/are TRUE?int list[7];i.The array consists of 7 element with the last index is 7ii.To access the third element, its syntax is list[2];iii.To initialize ALLthe elements with 1, use the following code:for(int i=0; i<=7; i++)list[i] = 1;iv.To go through each element in the array, the looping will start the index with 0 and end it with 6 3.What is the last index for an array size 100?
Image of page 1

Subscribe to view the full document.

4. Given the following a set of values in Table 1. Table 1: Integer values Set a) Declare and initialize a one- dimensional array to store the given values in Table1. int integer[20]={ 10 13 -23 -5 15 55 60 40 -20 -75 45 -1 35 44 89 -90 40 11 -21 -100}; b) Display and count the negative values in the array.
Image of page 2
Image of page 3
  • Fall '18

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes