NEW
Font size
WorksheetsQuiz on Array
Total questions: 10
Worksheet time: 3mins
An array index starts with?
-1
0
1
2
What is the output of C Program.?
int main() {
int a[];
a[4] = {1,2,3,4};
printf("%d", a[0]); }
1
2
4
Compiler Error
What is right way to Initialize array?
int num[6] = { 2, 4, 12, 5, 45, 5 };
int n{} = { 2, 4, 12, 5, 45, 5 };
int n{6} = { 2, 4, 12 };
int n(6) = { 2, 4, 12, 5, 45, 5 };
An array elements are always stored in ________ memory locations.
Sequential
Random
Sequential and Random
None of the above
What is the maximum number of dimensions an array in C may have?
2
8
20
50
Theoratically no limit. The only practical limits are memory size and compilers.
What will be printed after execution of the following code?
void main()
{
int arr[10] = {1,2,3,4,5};
printf("%d", arr[5]);
}
Garbage Value
5
6
0
None of These
Array is an example of _______ type memory allocation.
Compile time
Run time
The parameter passing mechanism for an array is
call by value
call by reference
call by value-result
None of the above
When does the ArrayIndexOutOfBoundsException occur?
Compile-time
Run-time
Not an error
Not an exception at all
Which of these best describes an array?
A data structure that shows a hierarchical behavior
Container of objects of similar types
Arrays are immutable once initialized
Array is not a data structure
