Wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

Introduction to Arrays and Arduino

Total questions: 4

Worksheet time: 2mins

Name
Class
Date
1.

Which statement best defines an array in programming?

a)

A collection of unrelated data elements stored randomly in memory

b)

A collection of similar data elements stored at contiguous (sequential) memory locations

c)

A single variable that can change its data type automatically

d)

A file that holds multiple programs

2.

Based on the example int myPins[5] = {2, 4, 8, 3, 6};, what is the valid index of the last element in this array?

a)

4

b)

5

c)

0

d)

6

3.

Consider the 1D array declaration: int num[4] = {2, 1, 4, 5}; and int val[2]; In the setup, val[0] is assigned num[1] + num[3]. What value will be stored in val[0]?

a)

3

b)

6

c)

7

d)

9

4.

char name[5][4]={

             {'t','r','e','e'},

                 {'b','o',’w','1'},

                 {'h','a','t'},

                 {'m','i','c','w'},

                 {'t','o','o','n'}

                };


a)

2D

b)

3D

c)

1D

d)

none of these