You are on page 1of 24

C++ Arrays

and Pointers
Quiz
Time to test your knowledge!
PART I.
IDENTIFICATION: 10 items
IDENTIFICATION: 1 point each

1. What do you call the number that is associated with


each element in an array?
2. A special type of variable that can store multiple values
of only a single data type at a contagious location in
computer memory.
IDENTIFICATION: 1 point each

3. We specify the name of an array followed by

and specify the number of elements it should store

4. To get the array size, the size of the array by the size of the

data type it contains:

5. The array indices start with .


IDENTIFICATION: 1 point each

6. In a one-dimensional array, the first index


also is called the...?
7. This represents the total number of elements
that the array can hold.
8. A data structure that stores a fixed-size
sequential collection of elements of the same type.
IDENTIFICATION: 1 point each

9. What symbol can be used to initialize an array during


declaration?
10. Who developed C++?
PART II.
MODIFIED FACT OR BLUFF: 5 items
FACT OR BLUFF : 2 points each
1. You can modify the size of an array after it has
been declared.
2. Arrays can be initialized during declaration using
index notation ([]).
3. In C++, if an array has a size n, we can store up to
any number of elements in the array.
FACT OR BLUFF : 2 points each

4. The syntax for declaring arrays is


dataType arrayName[arrayIndex];
5. The elements of a multidimensional
array are accessed using triple indices.
PART III.
FILL IN THE BOXES: 6 items
FILL IN THE BOXES: 2 points each
PART IV.
MULTIPLE CHOICE : 4 items
MULTIPLE CHOICE : 1 point each

1. Given the following declaration, where is the value 77


stored in the scores array?
int scores[] = {83, 62, 77, 97, 86}

A scores[0] C scores[2]

scores[1] D scores[3]
B
MULTIPLE CHOICE : 1 point each

2. What is the array index of the upper bound


of the following array?
int values[5];

A 0 C 4

5 D 6
B
MULTIPLE CHOICE : 1 point each
3. What will the following code display?
int numbers[5] = {99, 87, 66, 55, 101};
for (int i = 1; i < 4; i++) {
cout << numbers[i] << " "; }

A 99 87 66 55 101 C 87 66 55

87 66 55 101 D scores[3]
B
MULTIPLE CHOICE : 1 point each

4. What operator is used to get the size of an array?

A size of () C size of []

sizeof() D sizeof[]
B
PART IV.
MISSING CODE : 5 items
MISSING CODE
1. for 2 points

SECRET
MISSING CODE
1. for 3 points

SECRET

SECRET
PeTa Time!
INDIVIDUAL PeTa #1
Create a C++ program that uses a multidimensional array x with 5 rows and 2
columns, and then prints the product of each row's two elements:
DIADS PeTa #2

The program takes number


of element from user and
stores data in an array.
Then, this program
displays the largest element
of that array using loops.

You might also like