C Programming Quiz - Arrays

Quiz: Arrays

If you haven't already done so, be sure to read through Cprogramming.com's tutorial on Arrays. Otherwise, best of luck with the quiz!

1. Which of the following correctly declares an array?
A. int anarray[10];
B. int anarray;
C. anarray{10};
D. array anarray[10];

2. What is the index number of the last element of an array with 29 elements?
A. 29
B. 28
C. 0
D. Programmer-defined

3. Which of the following is a two-dimensional array?
A. array anarray[20][20];
B. int anarray[20][20];
C. int array[20, 20];
D. char array[20];

4. Which of the following correctly accesses the seventh element stored in foo, an array with 100 elements?
A. foo[6];
B. foo[7];
C. foo(7);
D. foo;

5. Which of the following gives the memory address of the first element in array foo, an array with 100 elements?
A. foo[0];
B. foo;
C. &foo;
D. foo[1];


Answer Key
Next lesson: Lesson 9, strings