Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Computer programming-Array

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

■An array is a group of memory locations that have ______________________________.

a)

the same name and different type

b)

the same name

c)

the same name and the same type.

d)

the different name and type

2.

Two types of Array are:

a)

1 Dimensional Array and 2 Dimensional Array

b)

2 Dimensional Array and 3 Dimensional Array

c)

Linear Array and Dynamic Array

d)

Sequence Array and Non-Sequence Array

3.

Declaration statement for an array named arr with size 5 is

a)

int arr[0];

b)

int arr[5];

c)

int arr(5);

d)

int arr[4];

4.

Declaration and initialize statement for an array named number with 1.1, 2.2 and 3.3 is written as

a)

float number[2] = {1.1, 2.2, 3.3};

b)

int number[3] = {1.1, 2.2, 3.3};

c)

float number[3] = {1.1, 2.2, 3.3};

5.

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


The statement to display the third element of an array a is

a)

printf(“ Array a[2] = %d \n”, a[2]);

b)

printf(“ Array a[3] = %d \n”, a[3]);

6.

Statement to display the fourth element of the array arr.


int arr[5]={12,23,31,42,51};

a)

printf(“ Array arr[4] = %d \n”, arr[4]);

b)

printf(“ Array arr[3] = %d \n”, arr[3]);

7.

The output will display:

a)

3

b)

4

c)

5

8.

Declaration statement of the array named x with 'u', 'i', 't' and 'm' will show as:

a)

char x[4] = {'u', 'i', 't', 'm'};

b)

char x[5] = {'u', 'i', 't', 'm'};

9.

Printf statement to print all character in the array is

a)

printf(" printing %s \n");

b)

printf(" printing %c \n", arr);

c)

printf(" printing %s \n", arr);

10.

The output will display,

a)

printing h

printing e

printing l

printing l

printing o

b)

printing

h

e

l

l

o

c)

printing h e l l o