41. What will be the output of the following code?
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
void main()
{
int a[10];
printf("%d %d", a[-1], a[12]);
}
42. What does the following declaration mean?
int (*ptr)[10];
int (*ptr)[10];
43. Array passed as an argument to a function is interpreted as
44. What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
#include<stdio.h>
void main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u", a+1, &a+1);
}
#include<stdio.h>
void main()
{
int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
printf("%u, %u", a+1, &a+1);
}
45. What will be the output of the program?
#include<stdio.h>
int main()
{
int arr[1] = {10};
printf("%d", 0[arr]);
return 0;
}
#include<stdio.h>
int main()
{
int arr[1] = {10};
printf("%d", 0[arr]);
return 0;
}
46. What will be the output of the program if the array begins at address 65486?
#include<stdio.h>
void main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u", arr, &arr);
}
#include<stdio.h>
void main()
{
int arr[] = {12, 14, 15, 23, 45};
printf("%u, %u", arr, &arr);
}
47. What will be the output of the program?
#include<stdio.h>
void main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d", sizeof(arr)/sizeof(arr[0]));
}
#include<stdio.h>
void main()
{
float arr[] = {12.4, 2.3, 4.5, 6.7};
printf("%d", sizeof(arr)/sizeof(arr[0]));
}
48. Which of the following is correct way to define the function fun() in the below program?
#include<stdio.h>
void main()
{
int a[3][4];
fun(a);
}
#include<stdio.h>
void main()
{
int a[3][4];
fun(a);
}
49. Which of the following statements are correct about the program below?
#include<stdio.h>
void main()
{
int size, i;
scanf("%d", &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf("%d", arr[i]);
printf("%d", arr[i]);
}
}
#include<stdio.h>
void main()
{
int size, i;
scanf("%d", &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf("%d", arr[i]);
printf("%d", arr[i]);
}
}
50. Which of the following statements are correct about an array?
1. The array int num[26]; can store 26 elements.
2. The expression num[1] designates the very first element in the array.
3. It is necessary to initialize the array at the time of declaration.
4. The declaration num[SIZE] is allowed if SIZE is a macro.
1. The array int num[26]; can store 26 elements.
2. The expression num[1] designates the very first element in the array.
3. It is necessary to initialize the array at the time of declaration.
4. The declaration num[SIZE] is allowed if SIZE is a macro.
Read More Section(Arrays and Strings)
Each Section contains maximum 100 MCQs question on Arrays and Strings. To get more questions visit other sections.