Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3-6 please 3. Identify error(s), if any, in the following array declarations. If a statement is incorrect, provide the correct statement. (1, 2) a. int

3-6 please

image text in transcribed

3. Identify error(s), if any, in the following array declarations. If a statement is incorrect, provide the correct statement. (1, 2) a. int primeNum (991: b. int testscores (0] c. string names (6017 d. int 1ist100 to..991 e double [50) gpa; cnat double LENGTH - 26; double 1ist [LENGTH 11 g. const long SIZE 100: int list(2 SIZE] 4. Determine whether the following array declarations are valid. If a declaration is invalid, explain why. (1, 2) a. int list [61]; b. strings names (201 c. double gpat) d. doublef-50] ratings (1i e. string flowers [35]: f. int SIZE 10: double sales [2 SIZE]: g. int MAX_SIZE 50 double sales [100 2MAX SIZE] What would be a valid range for the index of an array of size 65? What are the indices of the first, middle, and the last elements? (1, 3) Write C++ statement(s) to do the following: (1, 2) a. Declare an array alpha of s0 components of type int. b. Initialize each component of alpha to -1. c Output the value of the first component of the array alpha. d. Set the value of the 25th component of the array alpha to 62. e. Set the value of the 10th component of alpha to three times the s. 6. value of the 50th component of alpha plus 10. Use a for loop to output the value of a component of alpha if its index is a multiple of 2 or 3 Output the value of the last component of alpha. Output the value of the alpha so that 15 component Use a for loop to increment every other element (the even indexed eleme t. g. s per line are printed. nts) What is the size of diffAlpha? h. i Create a new array, diffAlpha, whose elements are the differen between consecutive elements in alpha

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Beginning Microsoft SQL Server 2012 Programming

Authors: Paul Atkinson, Robert Vieira

1st Edition

1118102282, 9781118102282

More Books

Students also viewed these Databases questions