WorksheetsArrays Part 1
Total questions: 10
Worksheet time: 5mins
Name
Class
Date
1.
What is the primary purpose of an array in programming?
a)
To store multiple values in a single variable.
b)
To create complex data structures.
c)
To define functions and methods.
d)
To execute loops more efficiently.
2.
How can you declare an array in programming?
a)
By using a function to create it dynamically.
b)
By naming it and specifying the number of blocks.
c)
By importing it from a library.
d)
By assigning it a single value.
3.
What do the lower and upper indices in an array represent?
a)
The range of values the array can hold.
b)
The data types stored in the array.
c)
The number of elements in the array.
d)
The memory size allocated for the array.
4.
Which statement is true about the elements in an array?
a)
All blocks must store the same type of data.
b)
Elements in an array cannot be modified after creation.
c)
Arrays can only store integer values.
d)
Each block can store one value of a specified data type.
5.
In the context of arrays, what do indices refer to?
a)
The positions of the blocks in the array.
b)
The values stored in the array.
c)
The size of the array.
d)
The data types of the array elements.
6.
Which of the following can an array hold?
a)
Only boolean values.
b)
Only strings.
c)
Only integers.
d)
Different data types, including integers and strings.
7.
How do you access an element in an array?
a)
By using the array name followed by its index in square brackets.
b)
By calling a function that retrieves the element.
c)
By using the array name and the element's value.
d)
By referencing the array in a loop.
8.
What is the purpose of using a for loop with an array?
a)
To sort the array elements.
b)
To iterate through the array and modify its values.
c)
To create a new array.
d)
To declare the array.
9.
What can you do with multiple arrays in programming?
a)
Use them to create a single data type.
b)
Only store data for one player.
c)
Combine them into a single array.
d)
Store data for different players.
10.
How can an array be initialized with default values?
a)
By using a loop to fill it after declaration.
b)
By defining it as a constant.
c)
By declaring it with a name and assigning values in brackets.
d)
By importing values from a file.
100 %
