wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

ARRAYS

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

What is an Array?

a)

A group of elements of same data type.

b)

An array contains more than one element

c)

Array elements are stored in memory in continuous or contiguous locations.

d)

All the above.

2.

In general, the index of the first element in an array is __________

a)

0

b)

-1

c)

2

d)

1

3.

What is meaning of following

declaration ?

int arr[20];

a)

Array of size 20 that can have integer address

b)

Array of Size 20

c)

Integer Array of size 20

d)

None of these

4.

Assuming int is of 2 bytes, what is the size of int arr[15];?

a)

15

b)

19

c)

11

d)

30

5.

What is the output of the following piece of code?


int arr[]= {1,2,3,4,5};

cout<<arr[2];

cout<<arr[4];

a)

3 and 5

b)

5 and 3

c)

2 and 4

d)

4 and 2

6.

How do you initialize an array in C++?

a)

int arr[3] = (1,2,3);

b)

int arr(3) = {1,2,3};

c)

int arr[3] = {1,2,3};

d)

int arr(3) = (1,2,3);

7.

Elements in an array are accessed _____________

a)

randomly

b)

sequentially

c)

exponentially

d)

logarithmically

8.

Choose a correct array statement.

a)

An array size can not changed once it is created.

b)

Array element value can be changed any number of times

c)

To access Nth element of an array students, use students[n-1] as the starting index is 0.

d)

All the above

9.

What is the length of the following array: int data[] = { 12, 34, 9, 0, -62, 88 };

a)

1

b)

5

c)

6

d)

12

10.

If we have declared an array described below -

int arr[6];

then which of the following array element is considered as last array element ?

a)

arr[6]

b)

arr[4]

c)

arr[0]

d)

arr[5]