1. Grade [2] refers to a third value stored in an array
a. True
b. False
2.Which of the following is a valid C++ array definition?
a. int scores[0];
b. float $payments[10];
c. int reading[4.5];
d. int scores[10];
3. The elements of an array are of different data types
a. True
b. False
4. The following declaration is valid char code[3] = {“sam”,”anna”,”max”}
a. True
b. False
5. Given the following declaration, where is the value 77 stored in the scores array? int scores[] = {83, 62, 77, 97};
a. scores[0]
b. scores[1]
c. scores[2]
d. scores[4]
Question 1:
The correct option is a: True because indexing in arrays start with a zero.
Question 2:
The correct option is d. int scores[10]; This declares array of 10 integers.
Question 3:
The correct option is b. False. This is because arrays stored elements of the same datatypes stored in contiguous memory location.
Question 4:
The correct answer is b. False. This is because a character is a letter in quotes not a combination of letters or symbols.
Question 5:
The correct answer is option c. scores[2] since indexing start at zero and 77 is the third element; therefore, it will be at index 2.
Comments
Leave a comment