wayground logo

Free Printable Worksheets

NEW

Font size

S
M
L
XL
Worksheets

Arrays in CQuiz

Total questions: 10

Worksheet time: 10mins

Name
Class
Date
1.

What is the general form of a single-dimension array declaration?

a)

type name[size];

b)

array name[type];

c)

name[size] type;

d)

size[type] name;

2.

What is the index of the first element in an array?

a)

2

b)

-1

c)

0

d)

1

3.

How many elements can a single-dimension array hold?

a)

Only one

b)

From one to several

c)

Exactly ten

d)

Unlimited

4.

What is the total bytes calculation for an integer array of size 5?

a)

15

b)

10

c)

25

d)

20

5.

What is the output of the program that prints array A with elements (-1, 33, 26, -5, 9)?

a)

1 2 3 4 5

b)

-1 0 33 26 9

c)

0 1 2 3 4

d)

-1 33 26 -5 9

6.

What is the correct syntax to declare an array of floats with 8 elements?

a)

float a(8);

b)

a[8] float;

c)

float[8] a;

d)

float a[8];

7.

What is the output of the sorting program for the array {4.3, -2.2, 33, 51, -39.5, 2.9, 6.5, 78}?

a)

-39.5 -2.2 2.9 4.3 6.5 33 51 78

b)

4.3 33 51 78 -39.5 -2.2 2.9 6.5

c)

78 51 33 4.3 2.9 -2.2 -39.5

d)

33 51 78 4.3 2.9 -2.2 -39.5 6.5

8.

What is the correct way to initialize an integer array with values -1, 33, 26, -5, 9?

a)

int A[5] = {10, 20, 30, 40, 50};

b)

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

c)

int A[5] = {-1, 33, 26, -5, 9};

d)

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

9.

What is the output of the program that multiplies two arrays A and B of size 10?

a)

The product of corresponding elements

b)

The sum of all elements

c)

The maximum element

d)

The average of all elements

10.

What is the correct way to declare an integer array of size 6?

a)

int B[6];

b)

int B(6);

c)

int[6] B;

d)

B[6] int;