250+ TOP MCQs on Pointers Vs. Multi-dimensional Arrays and Answers

C helps anyone preparing for Intel and other companies C interviews. One should practice these Objective Questions and answers continuously for 2-3 months to clear Intel interviews on C Programming language.

Here is a listing of C programming questions on “Pointers Vs. Multi-dimensional Arrays” along with answers, explanations and/or solutions:

1. What will be the output of the following C code (considering sizeof char is 1 and pointer is 4)?

  1.     #include 
  2.     int main()
  3.     {
  4.         char *a[2] = {"hello", "hi"};
  5.         printf("%d", sizeof(a));
  6.         return 0;
  7.     }

a) 9
b) 4
c) 8
d) 10
Answer: c
Clarification: None.

2. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         char a[2][6] = {"hello", "hi"};
  5.         printf("%d", sizeof(a));
  6.         return 0;
  7.     }

a) 9
b) 12
c) 8
d) 10
Answer: b
Clarification: None.

3. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         char a[2][6] = {"hello", "hi"};
  5.         printf("%s", *a + 1);
  6.         return 0;
  7.     }

a) hello
b) hi
c) ello
d) ello hi
Answer: c
Clarification: None.

4. What will be the output of the following C code?

  1.     #include 
  2.     int main()
  3.     {
  4.         char *a[2] = {"hello", "hi"};
  5.         printf("%s", *(a + 1));
  6.         return 0;
  7.     }

a) hello
b) ello
c) hi
d) ello hi
Answer: c
Clarification: None.

5. What is the advantage of a multidimensional array over pointer array?
a) Predefined size
b) Input can be taken from user
c) Faster Access
d) All of the mentioned
Answer: d
Clarification: None.

6. Which of the following operation is possible using a pointer char? (Assuming the declaration is char *a;)
a) Input via %s
b) Generation of the multidimensional array
c) Changing address to point at another location
d) All of the mentioned
Answer: c
Clarification: None.

7. Comment on the following two operations.

    int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
    int b[4][4] = {{1, 2, 3}, {1, 2, 3, 4}};//- 2

a) 1 will work, 2 will not
b) 1 and 2, both will work
c) 1 won’t work, 2 will work
d) Neither of them will work
Answer: c
Clarification: None.

8. Comment on the following two operations.

    int *a[] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 1
    int b[][] = {{1, 2, 3}, {1, 2, 3, 4}}; //- 2

a) 1 works, 2 doesn’t
b) 2 works, 1 doesn’t
c) Both of them work
d) Neither of them work
Answer: d
Clarification: None.

  250+ TOP MCQs on Typedefs and Answers

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top