0% found this document useful (0 votes)
19 views2 pages

1.) An Array Quiz

An array is a collection of elements of the same data type stored in contiguous memory locations. Arrays allow storing multiple elements of the same type together and accessing them using indexes. Some key points about arrays in C include: - Arrays can store elements of the same data type. - Elements are stored in contiguous/sequential memory locations. - Character arrays are null-terminated with '\0'. - Uninitialized arrays may contain garbage values. - All array elements must be defined but not all need be initialized. - The index value used to access the last element of an array is always one less than the total size of the array.

Uploaded by

Ayush Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
0% found this document useful (0 votes)
19 views2 pages

1.) An Array Quiz

An array is a collection of elements of the same data type stored in contiguous memory locations. Arrays allow storing multiple elements of the same type together and accessing them using indexes. Some key points about arrays in C include: - Arrays can store elements of the same data type. - Elements are stored in contiguous/sequential memory locations. - Character arrays are null-terminated with '\0'. - Uninitialized arrays may contain garbage values. - All array elements must be defined but not all need be initialized. - The index value used to access the last element of an array is always one less than the total size of the array.

Uploaded by

Ayush Sharma
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1/ 2

1.

) An Array is a collection of -
Different data types
Same data types
Both (a) and (b)
None of these
2.) Array elements are stored in -
Scattered memory locations
Sequential memory locations
Both (a) and (b)
None of these
3.) A character array is always ends with -
Null ('\0') character
Question Mark (?)
Full stop (.)
None of these
4.) If you declare array without static the elements it will be set to -
A null value
zero
Garbage value
None of these
5.) Arrays cannot be intialized if they are -
Automatic
external
static
None of the above
6.) All the elements in the array must be -
Initialized
Defined
both (a) and (b)
None of the above
7.) What will be the output of the following program -
#include <stdio.h>
int main(){
int a1[5] = {1};
int b=0, k=0;
for(b=0;b<=4;b++)
print("%3d", ++a1[0]);
return 0;
}
2 3 4 5 6
1 2 3 4 5
1 1 1 1 1 1
1 2 2 2 2 2
8.) How many integer values can the array N[5][5] store?
10
16
24
25
9.) What index value should be used to access the last element of the integer array
N[10]?
10
9
11
None of the above
10.) The process of creating a fixed-sized array be allocating memory space at
compile time is called __________ .
Static memory allocation
Run time memory allocation
Dynamic memory allocation
None of the above
11.) An array N[3] = {1,2,3} has been declared and intialized in a C program. What
will be the output of the folling statement - printf("%d", N[3]);
3
2
4
Garbage value
12.) It is required to store the names of five students. Which of the following
array declaration statements can be used for this?
Add description here!
char student[4][25]
char student[5][25]
char student[25][25]
char student[25][5]
13.) An array ARR[5][20] has been declared. What will be the output of the
following statement? printf("%d", sizeof(ARR));
100
200
400
800
14.) The variable used as a subscript in an array is probably known as _______
variable.
Control
Index
Constant
None of the above
15.) An array can be initialized -
Compile time
Run time
Both (a) and (b)
None of the above
16.) Array name -
A common name shared by all elements
An array variable
A keyboard
Not used in the program
17.) One dimentional array is known as -
vector
table
an array of arrays
matrix
18.) Array subscript in C always start at -
-1
0
1
any value
19.) Maximum number of elements in the array declaration int x[15] is -
15
14
16
Undefined
20.) What are the types of arrays?
int, long, float, double
struct, enum
char
All of the above

You might also like