In an array, size declarator is used to specify the number of elements in an array.
Hence, the correct answer is option “B”.
Explanation of Solution
Array size declarator:
- The number that is given inside the square brackets at the time of array declaration is called as array size declarator.
- The value should not be in negative.
- In order to avoid changing of size inside the source code, the programmers desires to use named constants as array size declarator.
Example for array size declarator:
int arrayName[10];
In the above example:
int – It is the data type
arrayName – Name of the array
10 – Size of the array
Explanation for incorrect options:
Subscript:
Each and every element in an array is assigned to a special value called as subscripts or indexes.
Hence, the option “A” is wrong.
Array Name:
Array name is not used to specify the number of elements in an array rather it mentions the name of the array.
Hence, the option “C” is wrong.
Initialization value:
It is nothing but the data that are given inside the array.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 8 Solutions
Starting Out with Programming Logic and Design (5th Edition) (What's New in Computer Science)
- (Electrical eng.) Write a program that declares three one-dimensional arrays named volts, current, and resistance. Each array should be declared in main() and be capable of holding 10 double-precision numbers. The numbers to store in current are 10.62, 14.89, 13.21, 16.55, 18.62, 9.47, 6.58, 18.32, 12.15, and 3.98. The numbers to store in resistance are 4, 8.5, 6, 7.35, 9, 15.3, 3, 5.4, 2.9, and 4.8. Your program should pass these three arrays to a function named calc_volts(), which should calculate elements in the volts array as the product of the corresponding elements in the current and resistance arrays (for example ,volts[1]=current[1]resistance[1]). After calc_volts() has passed values to the volts array, the values in the array should be displayed from inside main().arrow_forward(Data processing) Write a program that uses an array declaration statement to initialize the following numbers in an array named slopes: 17.24, 25.63, 5.94, 33.92, 3.71, 32.84, 35.93, 18.24, and 6.92. Your program should locate and display the maximum and minimum values in the array.arrow_forwarda) create a method that accepts a 2D array and shuffles it values (like playing cards) b) test your method from main: print your 2D array before and after c) create a similar method that will return the array. Call and test it from main .arrow_forward
- 23. True or False: The bracket of the array type can be associated with the element type or with the name of the array. float[] prices; -> float prices[]; False True Give an explanation for the answer. Thank youarrow_forwardAn array for a maximum 20 numbers, the user will determine the total number to enterfrom keyboard. Then, check the prime numbers in an array and screen them whether it’sa prime number or not a prime number c code writearrow_forwardConstant Integer SIZE = 10 Declare Integer values [SIZE] a. How many elements does the array have? b. What is the subscript of the first element in the array? c. What is the subscript of the last element in the array?arrow_forward
- EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTProgramming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageC++ for Engineers and ScientistsComputer ScienceISBN:9781133187844Author:Bronson, Gary J.Publisher:Course Technology Ptr
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,Programming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage LearningC++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning