Podcast
Questions and Answers
What is an array?
What is an array?
- A collection of random data items
- An unordered set of similar data items
- A collection of different data types
- An ordered set of similar data items (correct)
Where are the data items of an array stored in memory?
Where are the data items of an array stored in memory?
- Separate memory locations
- Adjacent memory locations
- Consecutive memory locations (correct)
- Random memory locations
How should an array be declared before use?
How should an array be declared before use?
- Array elements are accessed using different names
- Data types can vary within an array
- Size is specified during declaration (correct)
- Size is not required during declaration
What is the range of an array with n elements?
What is the range of an array with n elements?
How can arrays be initialized at compile time?
How can arrays be initialized at compile time?
What is the syntax for declaring an array?
What is the syntax for declaring an array?
What type of values can array elements be initialized with?
What type of values can array elements be initialized with?
int arr[5];
What does this code initialize?
int arr[5];
What does this code initialize?
{1, 2, 3, 4}
How are these values represented in an array initialization?
{1, 2, 3, 4}
How are these values represented in an array initialization?
float numbers[10];
What does this code declare?
float numbers[10];
What does this code declare?
What happens if the number of values to be initialized is more than the size of the array in C language?
What happens if the number of values to be initialized is more than the size of the array in C language?
When an array is partially initialized in C, what happens to the remaining elements?
When an array is partially initialized in C, what happens to the remaining elements?
What does the C compiler do if an array is initialized with all zeros?
What does the C compiler do if an array is initialized with all zeros?
What is the size of array 'b' in the declaration 'char b[]={'C','O','M','P','U','T','E','R'};'?
What is the size of array 'b' in the declaration 'char b[]={'C','O','M','P','U','T','E','R'};'?
In string initialization of an array in C, what character ends the string?
In string initialization of an array in C, what character ends the string?
What will happen if you initialize an array in C without specifying the size directly?
What will happen if you initialize an array in C without specifying the size directly?
How does run time initialization of an array differ from compile time initialization in C?
How does run time initialization of an array differ from compile time initialization in C?
If you declare 'int ch[]={1,0,3,5};', what will be the size of the array 'ch'?
If you declare 'int ch[]={1,0,3,5};', what will be the size of the array 'ch'?
'char b="COMPUTER";' - Is this a correct way to initialize a character array in C?
'char b="COMPUTER";' - Is this a correct way to initialize a character array in C?
'int a={9,2,4,5,6};' - What error will be encountered with this initialization?
'int a={9,2,4,5,6};' - What error will be encountered with this initialization?