NEW
Font size
WorksheetsARRAYS
Total questions: 10
Worksheet time: 5mins
What is an Array?
A group of elements of same data type.
An array contains more than one element
Array elements are stored in memory in continuous or contiguous locations.
All the above.
In general, the index of the first element in an array is __________
0
-1
2
1
What is meaning of following
declaration ?
int arr[20];
Array of size 20 that can have integer address
Array of Size 20
Integer Array of size 20
None of these
Assuming int is of 2 bytes, what is the size of int arr[15];?
15
19
11
30
What is the output of the following piece of code?
int arr[]= {1,2,3,4,5};
cout<<arr[2];
cout<<arr[4];
3 and 5
5 and 3
2 and 4
4 and 2
How do you initialize an array in C++?
int arr[3] = (1,2,3);
int arr(3) = {1,2,3};
int arr[3] = {1,2,3};
int arr(3) = (1,2,3);
Elements in an array are accessed _____________
randomly
sequentially
exponentially
logarithmically
Choose a correct array statement.
An array size can not changed once it is created.
Array element value can be changed any number of times
To access Nth element of an array students, use students[n-1] as the starting index is 0.
All the above
What is the length of the following array: int data[] = { 12, 34, 9, 0, -62, 88 };
1
5
6
12
If we have declared an array described below -
int arr[6];
then which of the following array element is considered as last array element ?
arr[6]
arr[4]
arr[0]
arr[5]
