What will happen if in a C program you assign a value to an array element whose subscript exceeds the size of array?

The element will be set to 0.
The compiler would report an error.
The program may crash if some important data gets overwritten.
The array size would appropriately grow.
What will be the output of the program ?
#include<stdio.h>

int main()
{
    int a[5] = {5, 1, 15, 20, 25};
    int i, j, m;
    i = ++a[1];
    j = a[1]++;
    m = a[i++];
    printf("%d, %d, %d", i, j, m);
    return 0;
}

2, 1, 15
1, 2, 5
3, 2, 15
2, 3, 20
Which of the following is correct way to define the function fun() in the below program?
#include<stdio.h>

int main()
{
    int a[3][4];
    fun(a);
    return 0;
}

void fun(int p[][4])
{
}
void fun(int *p[4])
{
}
void fun(int *p[][4])
{
}
void fun(int *p[3][4])
{
}
A pointer to a block of memory is effectively same as an array

True
False
What does the following declaration mean?
int (*ptr)[10]

ptr is array of pointers to 10 integers
ptr is a pointer to an array of 10 integers
ptr is an array of 10 integers
ptr is an pointer to array
What will be the output of the program in Turbo-C ?
#include<stdio.h>

int main()
{
    int arr[5], i=-1, z;
    while(i<5)
        arr[i]=++i;

    for(i=0; i<5; i++)
        printf("%d, ", arr[i]);

    return 0;
}

1, 2, 3, 4, 5,
-1, 0, 1, 2, 3, 4
0, 1, 2, 3, 4,
0, -1, -2, -3, -4,
Which of the following statements mentioning the name of the array begins DOES NOT yield the base address?
1: When array name is used with the sizeof operator.
2: When array name is operand of the & operator.
3: When array name is passed to scanf() function.
4: When array name is passed to printf() function.

A
A, B
B
B, D
Does this mentioning array name gives the base address in all the contexts?

Yes
No
In C, if you pass an array as an argument to a function, what actually gets passed?

Value of elements in array
First element of the array
Base address of the array
Address of the last element of array
What will be the output of the program if the array begins at 65486 and each integer occupies 2 bytes?
#include<stdio.h>

int main()
{
    int arr[] = {12, 14, 15, 23, 45};
    printf("%u, %u", arr+1, &arr+1);
    return 0;
}

65488, 65490
64490, 65492
65488, 65496
64490, 65498
Which of the following statements are correct about the program below?
#include<stdio.h>

int main()
{
    int size, i;
    scanf("%d", &size);
    int arr[size];
    for(i=1; i<=size; i++)
    {
        scanf("%d", arr[i]);
        printf("%d", arr[i]);
    }
    return 0;
}

The code is erroneous since the subscript for array used in for loop is in the range 1 to size.
The code is erroneous since the values of array are getting scanned through the loop.
The code is erroneous since the statement declaring array is invalid.
The code is correct and runs successfully.
Is there any difference int the following declarations?
int fun(int arr[]);
int fun(int arr[2]);

Yes
No
What will be the output of the program ?
#include<stdio.h>

int main()
{
    static int a[2][2] = {1, 2, 3, 4};
    int i, j;
    static int *p[] = {(int*)a, (int*)a+1, (int*)a+2};
    for(i=0; i<2; i++)
    {
        for(j=0; j<2; j++)
        {
            printf("%d, %d, %d, %d", *(*(p+i)+j), *(*(j+p)+i), 
                                    *(*(i+p)+j), *(*(p+j)+i));
        }
    }
    return 0;
}

1, 1, 1, 1
2, 3, 2, 3
3, 2, 3, 2
4, 4, 4, 4
1, 2, 1, 2
2, 3, 2, 3
3, 4, 3, 4
4, 2, 4, 2
1, 1, 1, 1
2, 2, 2, 2
2, 2, 2, 2
3, 3, 3, 3
1, 2, 3, 4
2, 3, 4, 1
3, 4, 1, 2
4, 1, 2, 3
Which of the following statements are correct about 6 used in the program?
int num[6];
num[6]=21;

In the first statement 6 specifies a particular element, whereas in the second statement it specifies a type.
In the first statement 6 specifies a array size, whereas in the second statement it specifies a particular element of array.
In the first statement 6 specifies a particular element, whereas in the second statement it specifies a array size.
In both the statement 6 specifies array size.
Are the expressions arr and &arr same for an array of 10 integers?

Yes
No
What will be the output of the program ?
#include<stdio.h>

int main()
{
    void fun(int, int[]);
    int arr[] = {1, 2, 3, 4};
    int i;
    fun(4, arr);
    for(i=0; i<4; i++)
        printf("%d,", arr[i]);
    return 0;
}
void fun(int n, int arr[])
{
    int *p=0;
    int i=0;
    while(i++ < n)
        p = &arr[i];
    *p=0;
}

2, 3, 4, 5
1, 2, 3, 4
0, 1, 2, 3
3, 2, 1 0
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
1,4
2,3
2,4
What will be the output of the program ?
#include<stdio.h>
void fun(int **p);

int main()
{
    int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 8, 7, 8, 9, 0};
    int *ptr;
    ptr = &a[0][0];
    fun(&ptr);
    return 0;
}
void fun(int **p)
{
    printf("%d", **p);
}

1
2
3
4
What will be the output of the program ?
#include<stdio.h>

int main()
{
    static int arr[] = {0, 1, 2, 3, 4};
    int *p[] = {arr, arr+1, arr+2, arr+3, arr+4};
    int **ptr=p;
    ptr++;
    printf("%d, %d, %d", ptr-p, *ptr-arr, **ptr);
    *ptr++;
    printf("%d, %d, %d", ptr-p, *ptr-arr, **ptr);
    *++ptr;
    printf("%d, %d, %d", ptr-p, *ptr-arr, **ptr);
    ++*ptr;
    printf("%d, %d, %d", ptr-p, *ptr-arr, **ptr);
    return 0;
}

0, 0, 0
1, 1, 1
2, 2, 2
3, 3, 3
1, 1, 2
2, 2, 3
3, 3, 4
4, 4, 1
1, 1, 1
2, 2, 2
3, 3, 3
3, 4, 4
0, 1, 2
1, 2, 3
2, 3, 4
3, 4, 5
What will be the output of the program if the array begins at 65472 and each integer occupies 2 bytes?
#include<stdio.h>

int main()
{
    int a[3][4] = {1, 2, 3, 4, 4, 3, 2, 1, 7, 8, 9, 0};
    printf("%u, %u", a+1, &a+1);
    return 0;
}

65474, 65476
65480, 65496
65480, 65488
65474, 65488
What will be the output of the program in Turb C (under DOS)?
#include<stdio.h>

int main()
{
    int arr[5], i=0;
    while(i<5)
        arr[i]=++i;

    for(i=0; i<5; i++)
        printf("%d, ", arr[i]);

    return 0;
}

1, 2, 3, 4, 5,
Garbage value, 1, 2, 3, 4,
0, 1, 2, 3, 4,
2, 3, 4, 5, 6,
What will be the output of the program ?
#include<stdio.h>

int main()
{
    int arr[1]={10};
    printf("%d", 0[arr]);
    return 0;
}

1
10
0
6
What will be the output of the program if the array begins at address 65486?
#include<stdio.h>

int main()
{
    int arr[] = {12, 14, 15, 23, 45};
    printf("%u, %u", arr, &arr);
    return 0;
}

65486, 65488
65486, 65486
65486, 65490
65486, 65487
What will be the output of the program ?
#include<stdio.h>

int main()
{
    float arr[] = {12.4, 2.3, 4.5, 6.7};
    printf("%d", sizeof(arr)/sizeof(arr[0]));
    return 0;
}

5
4
6
7
What will be the output of the program if the array begins 1200 in memory?
#include<stdio.h>

int main()
{
    int arr[]={2, 3, 4, 1, 6};
    printf("%u, %u, %u", arr, &arr[0], &arr);
    return 0;
}

1200, 1202, 1204
1200, 1200, 1200
1200, 1204, 1208
1200, 1202, 1200