6. Which of the following correctly declares an array? a) int array[10] b) int a
ID: 3600813 • Letter: 6
Question
6. Which of the following correctly declares an array? a) int array[10] b) int array c) array(10): d) array array[10]: 7. What is the index number of the last element of a) 9 b) 8 c) 10 d) 7 8. Which of the following accesses the seventh element stored in array? a) array[6) b) array[7) c) array(7) d) array: 9. Everything defined at the program scope level (ie. outside functions and classes) is said to be- a) local scope b) regional scope c) global scope d) static scope 10. In a 2D array -myArray[4][5] which one of the following is true? a) row size = 4, column size 5 b) column size = 4, row size: 5 c) column size 4, row size = 0 d) column size 5, row size 0 11. What does your class can hold? a) data b) functions c) datatype only d) both a & bExplanation / Answer
6) Which of the following correctly declares an array?
Correct option: a) int array[10];
Explanation: array declaration consists of 3 part: first the data type,then variable name after that the number of elements enclosed in a [ ] (square bracket). Hence option a is correct. Option b, c and d are not correct as they does not match with the declaration rule.
7)What is the index number of the last element of an array with 9 elements?
Correct option: b) 8
Explanation: array index starts from 0. So 9th element’s index would be 8. Hence option b is correct. Option a, c and d are not correct.
8)Which of the following accesses the seventh element stored in array?
Correct option: a) array[6];
Explanation: array index starts from 0. So 7th element’s index would be 6. Hence option a is correct. Option b, c and d are not correct.
9)Everything defined at the program scope level, is said to be:
Correct option: c) global scope
Explanation: Everything that are defined outside of all the functions and are accessible throughout the program are said to have global scope. Everything that are declared inside a function or a block are are said to have local scope. Static scope sets the range of functionality of a variable in a way so that it may only be called from within the block of code in which it is defined. This scope is determined when the code is compiled. Regional scope is defined within regions; it is not accessible throughout the program. Hence option c is correct. Option b, a and d are not correct.
10) In a 2D array- myArray[4][5] which one of the following is true?
Correct option: a) row size=4, column size=5
Explanation: Two-dimensional (2D) arrays are indexed by two subscripts, one for the row and one for the column. Subscript of row comes first then subscript of column comes. Hence option a is correct. Option b, c and d are not correct.
11)What does your class can hold?
Correct option: d) both a & b
Explanation: A class can hold data variables as well as functions. Hence option d is correct. Option a and b are partially correct ; as class can hold both data and functions so option d is the correct one. Option c is not correct.
/*If this helps you, please let me know by giving a positive thumbs up. In case you have any queries, do let me know. I will revert back to you. Thank you!!*/
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.