C MCQ Questions and Answers on Arrays and Pointers 3

Image

Study C MCQ Questions and Answers on Arrays, Multidimensional Arrays and Pointers. Easily attend technical interviews after reading these Multiple Choice Questions.

Go through C Theory Notes on Arrays before studying questions.



1) What is the dimension of the C array int ary[10][5].?
A) 1
B) 2
C) 5
D) 10
Answer [=]
Answer[=]
2) What is the dimension of the below C Array.?
int ary[]={1,3,5,7};
A) 1
B) 2
C) 3
D) 5
Answer [=]
Answer[=]
3) Choose a correct statement with array pointers.
A) It is valid to add an integer number to an array pointer. Result can be anything.
B) It is valid to subtract an integer number from array pointer. Result can be anything.
C) Difference of pointers to two elements of an array gives the difference between their indexes.
D) All the above
Answer [=]
Answer[=]
4) Choose correct statement about C array pointers.
A) You can compare two array elements with *p == *(p+i)
B) You can compare two pointers with p1==p2.
C) Accessing out of bounds index element is valid and it returns a garbage value.
D) All the above.
Answer [=]
Answer[=]
5) What is the output of C Program with arrays.?
int main()
{
    int ary[] = {1, 3, 5};
    printf("%d %d", ary[-1], ary[4]);
    return 0;
}
A) 1 5
B) 0 0 
C) Compiler error
D) None of the above
Answer [=]
Answer[=]
6) What is the output of C Program with arrays.?
int main()
{
    static int ary[] = {1, 3, 5};
    printf("%d %d", ary[-1], ary[5]);
    return 0;
}
A) 0 0
B) -1 -1
C) Compiler error
D) None of the above
Answer [=]
Answer[=]
7) What is the output of C Program with arrays and pointers.?
int main()
{
    int ary[] = {11, 33, 55};
    int *p, *q;
    p = ary;
    q = ary+2;
    printf("%d %d",*p, *q);
    return 0;
}
A) 11 55
B) 11 13
C) 11 33
D) Compiler error
Answer [=]
Answer[=]


 

8) Difference between C Arrays, ary[10] and cry[10][10] is.?
A) ary[10] is a single dimensional array. cry[10][10] is a Multidimensional array.
B) ary[10] is a multidimensional array. cry[10][10] is a single dimensional array.
C) Size of ary[10] is sizeof(10* int). Size of cry[10][10] is sizeof(10*int).
D) None of the above.
Answer [=]
Answer[=]
9) Array of Arrays is also called.?
A) Multi Data Array
B) Multi Size Array
C) Multi Dimensional Array
D) Multi Byte Array
Answer [=]
Answer[=]
10) What is the output of C program with multidimensional array.?
int main()
{
    int ary[3][2] = {1,2,3,4,5,6};
    printf("%d %d", ary[0][0], ary[2][1]);
    return 0;
}
A) 2 5
B) 1 6
C) 1 5
D) 2 6
Answer [=]
Answer[=]
11) What is the output of C program with multidimensional arrays.?
int main()
{
    int ary[3][] = {6,5,4,3,2,1};
    printf("%d %d", ary[0][0], ary[2][1]);
    return 0;
}
A) 6 1
B) 6 2
C) 5 1
D) Compiler error
Answer [=]
Answer[=]
12) What is the output of C program with multidimensional arrays.?
int main()
{
    int ary[][3] = {6,5,4,3,2,1};
    printf("%d %d", ary[0][0], ary[1][0]);
    return 0;
}
A) 6 2
B) 6 3
C) 6 1
D) Compiler error
Answer [=]
Answer[=]
13) Choose an alternative definition of C Multidimensional array.?
int ary[][3] = {6,5,4,3,2,1};
A) int ary[2][3] = {6,5,4,3,2,1};
B) int ary[2][3] = {{6,5,4},{3,2,1}};
C) int ary[][3] = {{6,5,4},{3,2,1}};
D) All the above.
Answer [=]
Answer[=]
14) What is the output of C Program with arrays.?
int main()
{
    int ary[][2][3] = {
        {{1,2,3},{4,5,6}},
        {{7,8,9},{10,11,12}}
    };
    printf("%d %d", ary[0][0][0], ary[1][1][1]);
    return 0;
}
A) 1 12
B) 1 11
C) 7 12
D) 1 6
Answer [=]
Answer[=]


 

15) Choose a correct statement about a C Multidimensional array.
A) First Dimension size is optional when initializing the array at the same time.
B) Last Dimension size is optional when initializing the array at the same time.
C) It is a must to specify all dimensions of a multidimensional array.
D) Memory locations of elements of a multidimensional array is not sequential.
Answer [=]
Answer[=]
16) What is the output of C Program.?
int main()
{
    int ary[2][2][3] = {
        {{1,2,3},{4,5,6}},
        {{7,8,9},{10,11,12}}
    };
    int *p;
    p = &ary;
    printf("%d %d",*p, *p+11);
    return 0;
}
A) 1 11
B) 1 12
C) 2 12
D) Compiler error
Answer [=]
Answer[=]
17) What is the output of C Program.?
int main()
{
    int ary[2][2][3] = {
        {{1,2,3},{4,5,6}},
        {{7,8,9},{10,11,12}}
    };
    printf("%d",*(*(*(ary+1)+ 1)+2));
    return 0;
}
A) 10
B) 11
C) 12
D) Compiler error
Answer [=]
Answer[=]
18) Choose a correct C Statement to choose number 66 in the array, int ary[3][2] = {{11,22},{33,44},{55,66}};
A) ary[2][1]
B) *(*(ary+2)+1)
C) *ary[2]+1
D) All the above
Answer [=]
Answer[=]
19) A multidimensional array of dimension N is a collection of.?
A) Single Dimensional Arrays
B) N dimensional arrays
C) N-1 dimension arrays
D) N-2 dimension arrays
Answer [=]
Answer[=]
20) Choose a correct statement about a Multidimensional array and pointer.?
A) int *ptr[N] is an array of N integer pointers. Size is N * sizeof(1*int).
B) int (*ptr)[N] is a pointer to an array of N elements. Size of ptr is size of 1 integer.
C) An multidimensional array or a single dimensional array can contain pointer elements.
D) All the above
Answer [=]
Answer[=]


Like or Share

Show some care. Like or Subscribe. [FB]...[Youtube]

C MCQ App by ExamTray 

Android APP

Java MCQ App by ExamTray 

Android APP
ALL MCQ App by ExamTray Android APP

Ad

 

Some good C Books

Book Price
1. C: The Complete Reference  Check Price
2. Let Us C Check Price
3. Programming in ANSI C Check Price
4. The C Programming Language Check Price

We may get some affiliate commission for the above purchases.