250+ TOP MCQs on Array Reference and Answers

Compilers Multiple Choice Questions & Answers (MCQs) on “Array Reference”.

1. Which of the following correctly declares an array?
a) Int array[ 10]
b) int array
c) array{10}
d) array array[ 10]

Answer: a
Clarification: Correct declaration.

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

Answer: b
Clarification: The indexing in an array starts with zero hence we can say that the element.

3. Which of the following is a two-dimensional array?
a) array array[20][20]
b) int array[20][20]
c) int array[20, 20]
d) char array[20]

Answer: b
Clarification: Double dimensional arrays are declared in this format.

4. Which of the following correctly accesses the seventh element stored in tan?
a) tan[6]
b) tan[7]
c) tan(7)
d) tan

Answer: a
Clarification: The index no 6.

5. Which of the following gives the memory address of the first element in array tan?
a) tan[0]
b) tan
c) &tan
d) tan [1]

Answer: b
Clarification: The base address of the array is given by its name.

6. What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?
a) The compiler would report an error
b) May stop working abruptly if data gets overwritten
c) None of the mentioned
d) The element will be set to 0

Answer: b
Clarification: It often happens that the program crashes.

7. What does the following declaration mean?

a) Pointer to an array
b) None of the mentioned
c) Array of 10 integers
d) Pointer to an array & Array of 10 integers

Answer: a
Clarification: Points to array.

8. What is the meaning of the following declaration?

a) Integer Array of size 20
b) None of the mentioned
c) Array of size 20
d) Array of size 20 that can have higher integer address

Answer: a
Clarification: Declaration of an array.

9. What will be the size of below array elements?

a) 21
b) 22
c) 20
d) 19

Answer: c
Clarification: The number in square brackets denotes size of an array.

10. What is meaning of the following?

a) Interger array of size 20 pointing to an integer Pointer
b) None of the mentioned
c) Array of integer pointer of size 20
d) All of the mentioned

Answer: c
Clarification: Array of pointers to integers.

Leave a Reply

Your email address will not be published. Required fields are marked *