Podcast
Questions and Answers
What is the main characteristic of an array?
What is the main characteristic of an array?
- Elements are stored in random memory locations
- It is a collection of different data types
- All elements are of the same data type (correct)
- Elements cannot be accessed using a name
When should an array be declared?
When should an array be declared?
- After it is used in the program
- At the end of the program
- Before it is used in the program (correct)
- When its size is not specified
What information does specifying the size of an array during declaration provide to the compiler?
What information does specifying the size of an array during declaration provide to the compiler?
- Number of elements in the array (correct)
- Values to initialize the array with
- Type of data in the array
- Position of each element in memory
What is the syntax for declaring an array with 'n' data items?
What is the syntax for declaring an array with 'n' data items?
How are arrays initialized at compile time?
How are arrays initialized at compile time?
Which statement describes array initialization without size?
Which statement describes array initialization without size?
In which way can array elements be initialized with int, char, etc., during declaration?
In which way can array elements be initialized with int, char, etc., during declaration?
'0 to (n-1)' represents the range of an array because:
'0 to (n-1)' represents the range of an array because:
'Partial array initialization' means:
'Partial array initialization' means:
'String initialization' is a special kind of array initialization where:
'String initialization' is a special kind of array initialization where:
Which of the following array initialization statements would result in a compilation error?
Which of the following array initialization statements would result in a compilation error?
What happens when a partial array initialization is done in C language?
What happens when a partial array initialization is done in C language?
What is the size of the array 'b' in the statement 'char b[]={'C','O','M','P','U','T','E','R'};'?
What is the size of the array 'b' in the statement 'char b[]={'C','O','M','P','U','T','E','R'};'?
How is an array initialized when a string is used in C language?
How is an array initialized when a string is used in C language?
What does the 'scanf' function do in array initialization?
What does the 'scanf' function do in array initialization?
What would be the result of initializing an integer array 'x' using 'scanf("%d %d%d",&x,&x,&x);'?
What would be the result of initializing an integer array 'x' using 'scanf("%d %d%d",&x,&x,&x);'?
In C language, what happens if no size is specified during array initialization?
In C language, what happens if no size is specified during array initialization?
If an array declaration does not specify size but provides initial values, what determines the size of the array?
If an array declaration does not specify size but provides initial values, what determines the size of the array?
'char b="COMPUTER";' would cause a compilation error. What is the correct way to initialize this character variable with the string?
'char b="COMPUTER";' would cause a compilation error. What is the correct way to initialize this character variable with the string?